Should I use Spring Boot in your next project?
- Transfer

Most of my professional Java projects over the past decade have been based on Spring or JEE . Both platforms are developing quite confidently, but still suffer from various problems.
Spring and JEE are still the gold standard for large-scale Java projects and large development teams working on complex enterprise solutions. However, the inevitable consequence of the maturity of the Java community was a partial loss of previous enthusiasm and innovation, which significantly hit the credibility of both.
JEE has changed quite dramatically over the years, but is still condemned by developers for the approaches and solutions that have been designated by the creators of the platform as deprecated since the version of EJB 2.x. Many people still refer to JEE as “J2EE,” although the name change took place 8 years ago!
Spring is also noticeably improved, but not all users perceive this. Despite the possibility of creating using Spring 3.x and higher modern applications with a transparent, non-torn from the code configuration, most projects continue to excessively dazzle with XML files and outdated architectural solutions. The problem is that many developers for one reason or another do not change the approach worked out on previous versions.
For these reasons, the road opened to other languages and frameworks. Java was probably the most popular language for personal projects, more than a dozen years ago, but young developers today seem to have begun to pay more attention to Python, Scala, etc. The most influential web frameworks of the previous decade, Rails , and the one based on Ruby Sinatra, have spawned a number of micro-frameworks over the past five years.
Groovy and Grails, in the Java world, was Ruby and Rails' first serious answer. They can now be found in the toolbox of even the most conservative enterprise development teams. However, the new JVM-based frameworks go much further. Instead of just wrapping the JEE and Spring APIs into an easy-to-use Play shell interface, the framework started, so to speak, from scratch, discarding even the seemingly fundamental Java servlet model.
Spring is no longer considered a modern innovative tool. Developers still use it, especially for older applications, but mainly because they must, and not because they themselves want it. I can’t remember the last time I spoke with a developer who used Spring in a personal project, while Play or a completely different platform are ubiquitous.
This is a shame, because Spring is an incredibly powerful tool if you can configure it correctly. Spring Data JPA provides simple management of relational databases without writing DAO classes, and Spring Data JPA also allows you to get the same functionality with NoSQL data stores if you can configure it correctly. In addition, with Spring, you have the ability toenterprise integration , access to the API of the most popular social services for your web or android applications, will take care of the security of your application through Spring Security , but, again, if you manage to configure everything correctly.
Building a Spring-based application can be a very painful process. This is partly due to the large number of existing alternatives when choosing technologies. For example, is it worth it to learn and use Spring Data JPA if you have already taken the time to learn JdbcTemplate and Hibernate / JPA? What is the difference between Spring Data REST and Spring HATEOAS ?
Another complicating factor is that Spring rarely recognizes something deprecated, and does not provide enough information to make an informed decision on the choice of technology, eliminate a variety of conflicts and solve other frequently occurring problems. If you search the Internet for an example of fixing a problem, links to outdated approaches and solutions will be in the top of the search results. For the most part, it is because of this that the XML configuration remains so widespread, despite the ease of implementation and maintenance of annotation-based configurations. Instead of using a clean template system like Thymeleaf or Velocity , most applications still use JSP with JSTL.
The thirst for eliminating these problems has never faded among the creators of Spring. Inspired by the Rails command-line tool , they presented Spring Roo- A quick development system, which also allows you to create elements such as web controllers or JPA entities via the command line. However, for non-trivial use, mastering Spring Roo is almost as difficult as building applications manually. Many developers were pushed away by the abundance of annotations and AspectJ files, which Roo universally adds to the project to provide its “magic”. Although it is stated that Roo can be easily and painlessly removed from the project, if necessary, the reality is more severe than theory. And even if you succeed, converting AspectJ to Java completely deprives you of the ability to use the magic command-line tool.
Spring Boot is the next generation of Spring application configuration simplification tools. It is not a means of automatic code generation, but is a plug-in for the automation system of project assembly (supports Maven and Gradle).
The plugin provides features for testing and deploying Spring applications. The mvn spring-boot: run command provides the launch of your application on port 8080. This is somewhat reminiscent of the fairly popular Maven Jetty plugin . In addition, Spring Boot allows you to pack the application into a separate jar file, with the full Tomcat container embedded. This approach is borrowed from the Play application deployment model (at the same time, you can also create traditional war files).
The main benefit of Spring Boot is resource configuration based on the content of the classpath. For example, if the pom.xml file of your Maven project contains JPA dependencies and the PostgreSQL driver, Spring Boot will configure the persistence module for PostgreSQL. If you add web dependency, you will get Spring MVC configured by default. If you need persistence and nothing else, Spring Boot will configure Hibernate as a JPA provider with the HSQLDB database. If you are creating a web application but not specifying anything additionally, Spring Boot will configure the view resolver for the Thymeleaf template system.
Speaking of the default configuration, Spring Boot is quite intuitive in this regard. You may not always agree with his choice of settings, but at least he will provide you with a working module. This is a very useful approach, especially for novice developers who can start working with the default settings, and then, as they explore existing alternatives, make configuration changes. Agree, this is much better than getting a bunch of difficult questions, without which it is simply impossible to start. In addition, on the official page of the project there are a number of complete tutorials that allow you to quickly understand and practically implement all the main types of projects at the “Hello world” level.

Building the application infrastructure, in fact, is to add the necessary modules to pom.xml:
...
org.springframework.boot spring-boot-starter-parent 1.0.0.RC3
...
com.mypackage.Application 1.7
...
org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-data-jpa com.h2database h2 1.3.174 org.springframework.boot spring-boot-starter-test test
...
org.springframework.boot spring-boot-maven-plugin
...
as well as writing the main Java class as follows:
@Configuration
@EnableAutoConfiguration
@ComponentScan
@PropertySource("classpath:application.properties")
public class Application {
@Bean
MyCustomService myCustomService() {
return new MyCustomService("");
}
public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(Application.class, args);
System.out.println("Let's inspect the beans provided by Spring Boot:");
String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
}
}
For most cases, changing the default settings, just change the POM file. So, in the example above, add dependency for the H2 database is demonstrated. Spring Boot, seeing this change, configures the JPA persistence module for the H2 database instead of the default HSQLDB. If you want to use Jetty as a built-in container, instead of the default Tomcat, just add the appropriate dependency.
At the moment, Spring Boot is in its infancy, and, of course, before going to a stable level, it will have to undergo many metamorphoses. It may be too early to use it for building serious systems, but it is quite suitable for various personal, training and test projects, the implementation of which is very important to get rid of the unwanted amount of unproductive, routine work, in no way connected with the creation of useful functionality.
In the context of the potential prospects of developing Spring Boot in the future as a serious tool for Spring development, it is especially encouraging to have acceptable technical documentation (though only in English and still rather meager, compared to the 800 page “encyclopedia” of the Spring Framework)