【黑马程序员SpringBoot2全套视频教程,springboot零基础到项目实战(spring boot2完整版)】
创建新模块【Maven 项目】

直接创建

一个干净的Maven 工程
修改pom.xml 文件
<parent>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-parentartifactId>
<version>2.7.4version>
parent>

<dependencies>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-webartifactId>
dependency>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-testartifactId>
<scope>testscope>
dependency>
dependencies>

这样第一步就完成了【记得刷一下】
接下来手写引导类

package com.dingjiaxiong;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* ClassName: Application
* date: 2022/10/15 19:32
*
* @author DingJiaxiong
*/
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class);
}
}
添加控制器
package com.dingjiaxiong.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* ClassName: BookController
* date: 2022/10/15 18:42
*
* @author DingJiaxiong
*/
//REST模式
@RestController
@RequestMapping("/books")
public class BookController {
@GetMapping
public String getById(){
System.out.println("SpringBoot is running...444");
return "SpringBoot is running...444手工制作牛逼!";
}
}

OK,启动服务器

测试接口

就是这样。