Spring Tool Suite is one of most popular IDEs for Java developers to develop Spring-based applications. If you don't have STS in your machine, first download the latest version of STS from the following link:
Let's create a new Spring Boot application in the STS
- Select New | Spring Starter Project menu item from the File menu as show below :
- As you click on Spring Starter Project, STS will present you with a dialog box as shown below:
- Click the Next button. It will present us with a another dialog box like the one shown below :
This dialog box asks for the same information as the web-based Spring Initializr. So, fill it in with the same information, as we filled in the web-based Spring Initializr.
- Finally, click on the Finish button.
In this dialog box, you can add dependencies as per your project need. For example, If you want to develop a web application, you can add web dependencies, devtools to pick up the changes and restart the application, my-sql or H2 dependencies for database.
As you click on Finish button, a project structure will get created in your workspace with default files and folders.
You must be connected to the internet in order for it to work, because STS internally delegates to the Spring Initializr at http://start.spring.io to produce the project.
Now that the project has been imported into your workspace. The structure of the project looks like below image :
As you can see, there's very little code in this project and it also creates a couple of empty directories. The generated project contains the following:
- pom.xml : A Maven build specification which contain all the dependencies of project.
- DemoAppApplication.java : A class with a main() method to bootstrap the application.
- DemoAppApplicationTests.java : An empty JUnit test class instrumented to load a Spring application context using Spring Boot auto-configuration.
- application.properties : An empty properties file for you to add configuration properties.
- templates directory : Here, you can put templates that render model data.