Spring Boot is relatively new project from Spring.io. Its aim is to simplify creating new Spring Framework based projects and unify their configuration by applying some conventions. This approach convention over configuration is already successfully applied in most of so called modern web frameworks like Ruby on Rails, Django or Play! Framework.
On the official website we can find primary goals:
- Provide a radically faster and widely accessible getting started experience for all
- Be opinionated out of the box, but get out of the way quickly as requirements start to
diverge from the defaults
- Provide a range of non-functional features that are common to large classes of projects
(e.g. embedded servers, security, metrics, health checks, externalized configuration)
- Absolutely no code generation and no requirement for XML configuration
Spring-Boot is not just another Spring Framework component. It’s actually much more. It’s a base, foundation for most (maybe even all) next Spring based applications you are going to write.
Spring Framework itself is very powerful tool. It can do a lot of things for you and if it can’t – it plays nice with most of other frameworks in Java world. It suffers one thing – it is difficult to start coding in Spring and it’s often blamed for complexity. Indeed – boostraping complexity was a price you pay for wide feture set and flexibility you can achive. That explains huge popularity of blog posts like Spring configuration with annotations, Spring without web.xml etc. There are just A LOT of ways to bootstrap Spring (which is actually good).
It happened that price paid was too high – especially when such flexibility was not really needed. I believe that’s how frameworks like Dropwizard and Play! Framework were born.
Ok, so what actually does Spring Boot do?
- simplifies project initial configuration – it is easier to start now with Spring than with Rails!
- project portability out of the box – you can build your project to JAR with embedded Tomcat or Jetty as well as classic WAR and deploy it to any application server or cloud service
- power-ups your development speed –
mvn spring-boot:run starts embedded Tomcat with Spring in seconds. Combined with JRebel let see changes you made immediately
- provides starters – dramatically easy integration with all Spring Framework family components. For example, if you want to use AOP just include
spring-boot-starter-aop and you are good to go: all necessary dependencies are configuration is there
- makes it easy to start application for functional/integration tests needs:
SpringApplication.run(Application.class, args); in
@Before method and your application is ready for Selenium or any other kind of real working application tests. You can forget about deploying application to container during
- provides basic metrics, health check and other nice features like remote shell support via CRaSH – hell yeah – you can now SSH to your application
Spring Boot is still under development. The latest version is 0.5.0 M7 and it is definitely ready for playing around and prototyping. Stable version will be released in the beginning of this year so don’t waste any time and have a look on Spring Guides introducing basic usage.
My recommendations for further reading/watching:
Read on →