Spring boot is one of the best suitable technology to implement micro service projects. One of the beautiful concept in Spring Boot is Auto configuration. Spring Boot auto configuration reduces the burden on developers by avoiding the traditional application configurations like data sources.
Spring Boot is typical framework to understand how it works internally. We need to understand Starter Parent and Auto configuration to understand about internal mechanism of Spring Boot. We will look at basic concepts of Spring boot to understand further concepts.
Prerequisites:
In this website I’m going to create Spring-Boot(2.X version) projects by using the below technical stack. To understand Spring-boot project better, you should have setup and have minimum knowledge of using below technologies.
Maven 3.1+ or Gradle-4.7
Any IDE Like Eclipse, STS, Intellij (Recommended)
JDK 1.8+
All projects typically uses spring-boot-starter-parent project as the parent in pom.xml. Spring-boot-starter-parent inherits dependency management from spring-boot-dependencies. Project version might be vary because lot of updates and releases are coming into it.
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.2.0.RELEASE</version> <type>pom</type> </dependency>
Auto Configuration: Spring boot provides the basic configuration needed to configure the application with these frameworks,
- Frameworks available in CLASSPATH
- Existing configuration for the application
How do we relate Spring boot, Spring MVC and Spring?
Spring Framework: Spring framework most important concept is Dependency Injection which is part of IoC/Inversion of Control is the core container of all Spring framework modules.
Spring MVC: Spring MVC is part of Spring framework which will help to make Enterprise application implementation is easy.
Spring Boot: We should not compare Spring Boot with Spring or Spring MVC. Spring boot makes those implementation is easy with the concept of Auto Configuration.
To achieve Spring MVC with Spring Boot, we need to annotate @EnableWebMvc in our configuration or need enable view resolver configuration by adding below properties in application.properties file.
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
How many ways we can create Spring Boot project?
There are two different ways of creating the Spring Boot project.
- By using Spring Initializr (https://start.spring.io/)
- By Using STS / IDE (like Eclipse/Intellij)