SpringBoot project construction process and start

Introduction to SpringBoot concepts

Spring Boot is a top-level project of Spring Company, which is at the same level as Spring Framework.
Spring Boot is actually done using the Spring Framework 4 auto-configuration feature. There is no need to write xml files when writing projects. Up to now, Spring Boot already has a very large ecosystem, and various mainstream technologies have provided Spring Boot starters.

Advantages of Spring Boot

① Spring Boot can be used to create an independent Spring application.
② Web containers such as Tomcat, Jetty, and Undertow are directly embedded in Spring Boot. There is no need to deploy WAR files when using Spring Boot for web development.
③ By providing your own starter (Starter) Rely on, simplify project construction configuration
④ Automatically configure Spring and third-party libraries as much as possible
⑤ Absolutely no code generation, and no XML configuration file required

Spring Boot version introduction

SNAPSHOT: Snapshot version, that is, the development version.
CURRENT: The latest version, but not necessarily a stable version.
GA: General Availability, the officially released version.

URL: Spring Boot

 Project build

Click Spring Initializr

name: project name

Select the Java version

 Configure the Springboot version, mine is 2.7.10, select the Spring Web package and click Next

 Configure the yml file

port:8081 - port number

#server.servlet.context-path=/myboot - classifies the project

#spring.application.name=SpringbootTest1 - project name

#application.properties写法
#server.port=8081
#spring.application.name=SpringbootTest1
#server.servlet.context-path=/myboot

#application.yml和ymal写法
server:
  port: 8081
  servlet:
    context-path: /myboot
spring:
  application:
    name: SpringbootTest1

 

startup class

import @SpringbootApplication

 Create the Controller layer

@RestController
@RequestMapping("Test")
public class TestController {

    @GetMapping("test")
    public String test() {
        return "text.........";
    }
}

Enter URL to visit

127.0.0.1:8081/myboot/Test/test1 

 

Guess you like

Origin blog.csdn.net/qq_55629923/article/details/129871703