运行日志
2023-03-24 22:17:50.605 INFO 12444 --- [ main] Springboot0101QuickstartApplicationTests : Starting Springboot0101QuickstartApplicationTests using Java 1.8.0_201 on PC-202301090337 with PID 12444 (started by Administrator in E:\code\Java\idea\SpringBoot\springboot\springboot_01_01_quickstart)
2023-03-24 22:17:50.607 INFO 12444 --- [ main] Springboot0101QuickstartApplicationTests : No active profile set, falling back to 1 default profile: "default"
2023-03-24 22:17:53.273 INFO 12444 --- [ main] Springboot0101QuickstartApplicationTests : Started Springboot0101QuickstartApplicationTests in 3.021 seconds (JVM running for 4.078)
pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.6</version>
<relativePath/>
</parent>
<groupId>com.ytlg</groupId>
<artifactId>springboot_01_01_quickstart</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>springboot_01_01_quickstart</name>
<description>springboot_01_01_quickstart</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.ytlg.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//Rest模式
@RestController
@RequestMapping("/books")
public class BookController {
@GetMapping
public String getById(){
System.out.println("springboot id running");
return "springboot is running";
}
}