Spring Boot for Rapid Application Development

Building Java applications using Spring Framework is pretty common. Spring creates repositories, service layers, and controllers for all exposed entities. Unfortunately, these classes are generally repetitive. Spring Roo tried to cut the overhead by automating this. Sadly, the use of AspectJ convoluted things devaluing the approach.

Spring Boot

Spring Boot removes a lot of the hassles of application development. Spring Boot applications can contain an embedded Tomcat to allow for a fat JAR deployment. This avoids the hassles of a managing a web container and WAR.  This works out really nicely if you use Heroku. Heroku requires you to provide your own container for Java applications.

To use Spring Boot in your Java project add the Spring Boot Parent POM:


To execute a Spring Boot application with Maven add the following plugin to your POM:

        <mainClass>Add Application Class Here</mainClass>

This will allow you to use mvn exec:java to execute your application. This is useful when developing in Eclipse. If you use the resource plugin for property replacement in your application.yml, executing the Java application from Eclipse won’t handle the replacements appropriately.  For example:

        artifact: @project.artifactId@
        name: @project.name@
        description: @project.description@
        version: @project.version@

Using mvn exec:java the @project.artifactId@ will be replaced with a real value. If you use Eclipse and Run as Java Application, this value is not replaced.

Simplified REST Resources

Applying the @RepositoryRestResource annotation to an interface replaces the repository, a service, and a controller to expose a Restful service.

public interface ObjectRepository extends CrudRepository<Object, Long> {

This will expose a route /objects. This route will create GET, POST, PUT, and DELETE operations. The only downside is that Spring exposes a REST service that constrains to HATEOAS.