Spring Initializr is essentially a Web application that generates a Spring Boot-based project structure for us. Spring Initializr can be used in the following ways.
1 Spring Initializr official website initialization
When you open start.spring. IO /, you will see the following interface:
- The first three items of the form indicate whether the project is built based on Maven or Gradle, the programming language used, and the Spring Boot version.
- Next, define groups and artifacts for the project.
- Then, select the required base dependency capabilities. The checked base dependencies are shown in the list on the right.
Open Options to perform more configurations:
Finally, click “Generate the project”, it will export the project structure based on Spring Boot according to the above configuration:
2 IntelliJ IDEA is initialized
You can also initialize the Spring Boot project directly in IntelliJ IDEA.
First create a new project:
Choose Spring Initializr. The default initialization is based on the Spring Initializr official URL:
Next, define groups and artifacts for the project:
Then, select the required base dependency capability:
Finally, define the project name and project path:
The project starts downloading Spring Boot dependencies from the Maven library:
Once the download is successful, you will see the downloaded and associated dependencies in Maven Projects:
3 Project Structure
Projects, whether based on the Spring Initializr website or initialized with IntelliJ IDEA, generate similar structures as follows:
File or folder | instructions |
---|---|
pom.xml | Maven configuration file. If you select Gradle project, it will be build. Gradle. |
xxxApplication.java | Used to boot and start the project. |
xxxApplicationTests.java | JUnit test class that can be used to test whether Spring Boot automatic configuration is effective. |
application.properties | You can configure the Spring Boot property here. |
static | Static files for Web projects, such as JavaScript, styles, images, and so on. |