SpringBoot-directory structure and startup mode-Spring02
Directory Structure
- pom.xml file
- Specify a parent project: Specify the current project as a springboot project, and help us declare the version that the starter depends on
- Project metadata, package name, project name, version number
- Specify properties information: specify java version 1.8
- Import dependency: spring-boot-starter-web is imported by default (springmvc, tomcat container, etc.), spring-boot-starter-test is imported only when web is added
- Plug-in: spring-boot-maven-plugin
-
.gitignore: help us ignore some files and directories by default
-
src directory
-src
-main
-java
-Package name
Start class.java. The controller class needs to be placed in a subpackage of the startup class or the same level package
-resource application.properity unique configuration file
-static store static resources
-template stores template pages
-test - only for testing
Three ways to start springboot
- Start the main method of the class
- Use the maven command. mvn spring-boot:run
- Use mvn clean package to type out the jar package and start it with java -jar