First SpringBoot project

1. Development steps

Project name: 001-Springboot-first

(1) Create a Module of type Spring Initializr to build quickly

(2) Set GAV coordinates and POM configuration information

(3) Select the Spring Boot version and its dependencies

Start dependencies are automatically added and automatically configured based on the selected dependencies

(4) Set the module name, Content Root path, and module file directory

Click Finish. If you are creating it for the first time, you will be prompted in the lower right corner that you are downloading the dependent

(5) The project has been created, as follows

(6) Project structure

Static: Stores static resources, such as images, CSS, and JavaScript

Templates: The template files that hold Web pages

Application. The properties/application. Yml to hold programs rely on the module configuration information, such as a service port, database connection configuration, etc

Second, the introduction case

Project name: 002- Springboot-SpringMVC

Create a new Module of type Spring Initializr

2. Specify GAV and POM configuration information

3. Select the Spring Boot version and its dependencies

Start dependencies are automatically added and automatically configured based on the selected dependencies

4. Change the Content Root directory and file directory

5. Interpret the pom. XML file

6. Describe the SpringBoot project structure

1). MVN | MVNW | MVNW. CMD: use scripts to perform maven command, domestic use is less, can be deleted

2).gitignore: When using the version control tool Git, set something to ignore commits

3) static | templates, template technology behind the files in the directory

4) Application. properties: SpringBoot configuration file, many integrated configuration can be configured in this file, such as: Spring, springMVC, Mybatis, Redis, etc. It is currently empty

5) Application. Java: SpringBoot program execution entry, execute the main method in the program, SpringBoot is started

Create a Spring BootController for Spring MVC

Package: SpringBootController class is com. Bjpowernode. Springboot. Web

Note: The newly created class must be in the Application sibling or child directory, otherwise SpringBoot adds

Can’t load.

8, right-click IDEA and run main in Application class

From the output in the console, you can see that starting the SpringBoot framework starts an embedded Tomcat with port 8080 and an empty context root

9, enter http://localhost:8080/springBoot/say in your browser to access