How to use Spring Initializr to create a project.
Spring starter dependencies.
Discuss the content i.e each and every line, of the generated build file.
Let’s take a look at project set up. That is mainly creating the build file. Often times dependencies could be tricky, there are so many external libraries and selecting versions that should be compatible with each other can be difficult at times.
But there’s a one stop shop for all the dependency requirements of a Spring Boot project. That’s the Spring Boot Starters. All you have to do is select a few starter dependencies according the type of project and the starter dependencies will take care of the rest.
You can find a list of Spring Boot Starters and a link to each of the build files here
So for example, if you are building a REST API or a web project, you would add the
spring-boot-starter-web dependency to your project and if you take a look at the build file, you can see all the other dependencies it includes. And if you want to use spring data jpa, you would add the spring-boot-starter-data-jpa dependency.
The Build File
id 'org.springframework.boot' version '2.4.4'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
Spring Initializer website: https://start.spring.io
Spring boot starters:
The Spring Initializr UI shown in the video above has been updated, if you want to see the latest, checkout this Spring Initializr tutorial