SpringBoot-directory structure and startup mode-Spring02

SpringBoot-directory structure and startup mode-Spring02

Directory Structure

  1. 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
  1. .gitignore: help us ignore some files and directories by default

  2. 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

  1. Start the main method of the class
  2. Use the maven command. mvn spring-boot:run
  3. Use mvn clean package to type out the jar package and start it with java -jar

Guess you like

Origin blog.csdn.net/rr18758236029/article/details/108525673