Digging into Spring Boot

Spring Boot is a new tool that came out last fall from the Spring Foundation.  It is a tool for getting started very quickly with Spring.  They have included many common requirements for a real application.  It exposes a lot of useful features by default and also allows you easy access to change those defaults.  The term “opinionated” Spring is used to describe the decisions made to use certain technologies.  This is where the many options in the Java sphere can make progress difficult when you look at the myriad of choices.

Spring boot has a lot of starter Maven POMs preconfigured so depending on what you are trying to build they bring in the right dependencies.  For instance the Spring starter web pom pulls in the Spring web MVC jars and the embeded Tomcat.   All this makes your Maven configuration setup quick and easy.  Phil Web, Spring Boot Co-lead, demonstrates how to get rolling with Groovy and Java on Spring Boot.


@RestController

@EnableAutoConfiguration

public class Example {

@RequestMapping("/")

    public String hello() {

      return "Hello World";

    }

}

The Rest Controller (@RestController) annotation will render JSON by default.  Spring Boot AutoConfiguration (@EnableAutoConfiguration) annotation attempts to automatically configure your Spring application based on the dependencies that it declares.  This is where they try to guess what you need to make the process of getting started easier for you.

There is also a nice Spring Boot quick start guide available on their website.  It has examples how to get things setup right away using Maven or Gradle.  “Absolutely no code generation and no requirement for XML configuration” is one of their bullet points.  Many people have pointed out the numerous entries in XML to get a Spring application off the ground.  I think the Spring team has heard this and they want to give people an option to get out of the configuration mess.

I have to say just reading through this and looking over the code examples makes me interested.  Although I would like to work with this in a production ready code to see what limitations or configuration issues we might find.  Time will tell if Spring Boot will gain traction with a large number of developers.

 

No comments yet.

Leave a Reply

Powered by WordPress. Designed by Woo Themes