Table of contents
Use Idea to build the first SpringBoot program
Step 2: Understand the project structure
What is Spring Boot?
Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run".
We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.
The above sentence is quoted from the SpringBoot official website, which means that SpringBoot can make the creation of an application very simple, and you only need to configure a few configuration files to run a program.
Completing a project requires the configuration of many configuration files. Even if you just want to implement a simple login function, you need to configure SpringMVC, Mybatis, etc., but SpringBoot can make the whole process very simple.
- Provides an easy and fast getting started experience for all Spring-based Java development
- Out-of-the-box, if you have your own custom configuration, use your own, if not, use the official one, the default one.
- Provides a series of general non-functional functions, such as embedded server, security management, health monitoring, etc.
- Absolutely no code generation and no xml configuration required.
- There is no need to configure static file filters anymore, just put them in the resources directory
Use Idea to build the first SpringBoot program
Step 1: Create a project
The Idea version (my version here is 2019.3) supports the construction of SpringBoot, select new Project, select Spring Initializer, and the rest can use the default configuration:
Modify Group and Artifact according to your own habits, click next:
Select Web, select Spring Web Starter (some people here only have the Web option, just select the same), and click next:
After the final modification is complete, click finish:
Step 2: Understand the project structure
It takes a while to create the process for the first time. After the creation is successful, the following project structure appears:
-
HrRetrievalApplication: responsible for starting the program
application.properties: an empty properties file, you can add configuration properties as needed
pom.xml: maven configuration file
-
Such a simple SpringBoot program is complete.
-
The following is the configuration of my entire project, you can be a reference!