Spring Boot as a key to fast-growing applications

In late 2012, Mike Youngstrom raised an issue that influenced the future of Spring Framework. The point that he proposed was to change the entirety of the Spring Architecture and simplify the usage of Spring Framework so developers may start building business logic faster. Even though that proposition was declined, it motivated the Spring team to create a new project that dramatically simplified Spring Framework usage. In mid-2013, the Spring team announced its first prerelease of a project under the name Spring Boot (see https://spring.io/projects/spring-boot for more details). The main idea behind Spring Boot was to simplify the application development process and allow users to begin a new project without any additional infrastructure configuration.

Along with this, Spring Boot adopts the containerless web application idea and executable fat JAR techniques. With this approach, Spring applications could be written on one line and be run with one additional command line. The following code shows a complete Spring Boot web application:

@SpringBootApplication 
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
}

The most important part of the preceding example is that there is an annotation called @SpringBootApplication that is required to run an IoC container. There is also the MVC server, as well as other application components. Let's dig into this a bit deeper. First of all, Spring Boot is a bunch of modules and additions to modern build tools, such as Gradle or Maven. In general, Spring Boot has two central modules on which it depends. The first one is the spring-boot module, which comes with all possible default configurations related to the Spring IoC container. The second one is spring-boot-autoconfigurewhich brings all possible configurations for all existing Spring projects, such as Spring Data, Spring MVC, Spring WebFlux, and so on. At first glance, it seems that all defined configurations are enabled at once, even if this is not required. However, this is not the case, and all configurations are disabled until a particular dependency is introduced. Spring Boot defines a new notion for modules that usually contain the word  -starter- in their name. By default, starters do not contain any Java code, but bring all relevant dependencies to activate particular configurations in spring-boot-autoconfigure. With Spring Boot, we now have the -starter-web and -starter-data-jpa modules, which allow the configuration of all required infrastructural parts without additional hassle. The most noticeable difference in the Spring Roo project is its greater flexibility. Along with the default configurations, which may easily be extended, Spring Boot provides a fluent API for building our own starters. This API allows the replacement of default configurations and provides us with our own configurations for particular modules.

For the purposes of this book, we do not cover the details of Spring Boot. However, Preview Online Code Files Learning Spring Boot 2.0, Second Edition by Greg L. Turnquist covers Spring Boot in great detail. We can find it at https://www.packtpub.com/application-development/learning-spring-boot-20-second-edition.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.191.86