What is Spring Boot?
Spring-Boot is an extra upper layer on the spring framework. It helps you handle all the configuration required in your respective project, you can consider spring-boot as ready to start working project in a few minutes just like your ready-to-eat food.
Questions come, “Why do we require spring-boot?”
Working on big complex enterprise projects requires multiple services, so handling all configurations and ensuring required dependencies is very complex. Spring-Boot fulfils the new-age Java Dev Framework requirement, which handles all your configurations and dependencies using automated configuration modules.
Removing the handling of configurations and dependencies burden helps developers focus on the core functionality of the product. Tomcat is installed as an embedded server in Spring Boot, eliminating the need for separate management of the web server.
Spring Boot Starters:
Enterprise applications typically require a set of common dependencies, which are provided by Spring Boot as starters. These basic starters help you to quickly bootstrap your applications and there are Web Starter, Data JPA Starter, Test Starter, etc.
To create a Web-MVC application, need to add spring-mvc dependency along with other required dependencies but in spring-boot only need to add/select spring-boot-starter-web dependency. By adding this, we automatically include all required dependencies for the spring web mvc project such as tomcat-embed-core, tomcat-embed-el, jackson-databind, jackson-datatype-jdk8, spring-webmvc, spring-web, hibernate-validator, etc. We add the following dependency to the Pom file. It’s an XML file that carries all the project dependencies.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
To communicate with the database, we use a model, considered a replica of the database table like user_details. JPA (Java persistence API) is a standard which usually followed to perform database operations. To add this dependency as above add the following dependency to the Pom file.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
This article aims to give a basic introduction to Spring Boot.