Spring Boot is built on top of the Spring framework and has all the features of Spring.
Let’s look into some of the important benefits of using Spring Boot.
Reduce Development Time
Spring Boot helps to quicken application development process. It is used to build stand-alone and production ready spring applications.Reduces development time and increases the overall productivity of the development team.
Easy Testing
Makes it easier for developers to create and test Java-based applications by providing a default setup for unit and integration tests.
Building Microservices
Spring Boot provides a set of features to quickly build microservices
Spring Boot Starters – Eases dependency management
Handling dependency management is a difficult task for big projects. Spring Boot resolves this problem by providing a set of dependencies for developers convenience.
Spring Boot starters are templates that contain a collection of all the relevant transitive dependencies that are needed to start a particular functionality.
For example, to create MVC application all you need to import is spring-boot-starter-web dependency.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Embedded Web Servers
Spring Boot supports Tomcat, Undertow, and Jetty as embedded web servers.
No need to deploy WAR files, just run the standalone spring application.
Spring boot applications use tomcat as default embedded server. You can exclude tomcat and include any other embedded server if you want. Or you can make exclude server environment altogether. It’s all configuration based.
Below configuration excludes tomcat and includes jetty as embedded web server.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
@EnableAutoConfiguration enables auto-configuration. It means that Spring Boot looks for auto-configuration beans on its classpath and automatically applies them.
Bootstrap the application
The entry point of the spring boot application is the class contains @SpringBootApplication annotation and the main method.
@SpringBootApplication = @Configuration + @EnableAutoConfiguration +@ComponentScan
@SpringBootApplication is equivalent to @Configuration, @EnableAutoConfiguration, and @ComponentScan together.
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
Spring Boot Actuator
Spring Boot Actuator provides in-built HTTP endpoints available for different monitoring and management purposes.
Please visit Spring Boot Actuator for more details.
Related Article : Exception Handling in Spring Boot: Comprehensive Guide