Spring Boot has made a significant impact in J2EE application development using the Spring Framework: this tool aids the developer with the implementation of a project using starters, which can be loaded in order to start using Spring’s basic features for that specific purpose.
In October 2012, Jira received a feature request from Spring about an accelerated Spring container that would configure services on a web container from the main method. This allowed containerless web architectures based on the Spring Framework to be supported. This request was made by Mike Youngstrom, and it could be regarded as marking the start of the Spring Boot project, on which development began a few months later, culminating in the launch of Spring Boot 1.0.0 in April 2014.
The current version of the project is 2.0.1, which requires version 5 of the Spring Framework, although it will work with Spring 4 for version 1.5.12 of Spring Boot. The project aims to facilitate the creation of Spring-based productive applications, minimising the amount of development work required. New and experienced developers alike can focus on actual development without needing to know how the application is installed or configured, since for instance the servers are embedded and preconfigured inside the project. Spring Boot does not generate code, nor does it require XML configuration.
When starting development, a dependency manager such as Gradle or Maven is recommended. These managers specify which version of Spring Boot to use, along with the starters which will preconfigure the project. There are more than 40 of them, and they configure the application for beginning to use applications ranging from basic Spring MVC to Spring Batch-based applications or those using JPA with Hibernate, as well as applications with JMS messaging or those with Aspect Oriented Programming (AOP) features.
Another of Spring Boot’s main features is that it enables out-of-the-box configuration of the application, which takes precedence over configuration within the packaged project. It allows straightforward configuration of the main application features based on default values that are set where properties are not specified. For example, a listening port can be set on the server for a web application developed using Spring Boot (it supports containers such as Tomcat, Jetty or Undertow) by simply adding the following line in the application.properties file:
server.port=8081
Or by adding this property when launching the application:
–server.port=8081
Looking in greater detail at some traditional application configurations, log configuration in Apache’s log4j library can be fairly time-consuming as it loads various files. In this case, settings may be changed by adding a line in the application.properties file:
logging.level.com.alvantia.example=DEBUG
In order to configure a datasource for accessing a database, simply go to the application.properties file and set the path, driver, user and password. This configuration makes available a datasource which the specific ORM being used, such as Hibernate-JPA or Mybatis, will use automatically without the need for additional configuration by simply using the appropriate starter.
Spring Boot also provides production environments with a micrometer-based metrics system which can be integrated with different monitoring systems (Atlas is the default; Datadog, Ganglia, etc.), an application health check system in order to make sure the application is still running or even force an application heapdump. These tools also allow changes to the hot logging level for a package or specific class. The system is called Spring Boot Actuator and it has an extensive API which can be customised to respond to specific application needs.
All these features, along with the simplicity of annotation based configuration and Java classes, while capitalising on the capabilities of the latest versions of the Spring Framework, mean that alvantia regards Spring Boot as a tool with a great deal of potential as part of any Java development, since it makes starting development work more straightforward, and it improves efficiency by allowing developers to focus on the coding task at hand.
alvantia has relied on Spring Framework for several years as the core of its applications developed in Java, and in light of current cloud developments, we regard Spring Boot as an essential tool for developing Microservices, and one that is fully adaptable to Docker containers or to Amazon Web Services environments. Its standalone services can be run in their own container (as in Docker) and can be launched and configured easily in a script, making it ideal for auto scaling and cloud deployment.
Spring Boot is here to speed up development, and here at alvantia we rely on it. It’s time for Spring Boot.