To create a project in Spring Boot we can use ‘Spring Initializr’ utility.
Spring Initializr
Spring Initializr is a Spring tool that helps us to create an initial project, from scratch, by choosing in a simple way
the dependencies we need.
We open the site Spring Initializr
There we have multiple options:
- Choose whether we will use Maven or Gradle to build our project.
- The versions of Spring and Java we will use.
- The data of your project for the group and the artifact.
- The dependencies you need.
For our project we will choose Gradle and the Spring Web dependency. Once you have chosen the options you can browse to preview your build.gradle and how your project will look like. In the GENERATE option you download the .zip file of the project ready to use.
Download the file and unzip it.
We open it with our IDE, in my case Intellij
From the command line we can run the application.
gradlew bootRun
Conclusion
Spring Initializr is a tool that simplifies the initial creation and dependencies of your project.