<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!--整合web模块-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
server:
port: 15026
undertow:
accesslog:
enabled: false
direct-buffers: true # 是否分配的直接内存(NIO直接分配的堆外内存)
buffer-size: 1024 #每块buffer的空间大小,越小的空间被利用越充分
threads:
worker: 20 # 阻塞任务线程池, 它的值设置取决于系统线程执行任务的阻塞系数,默认值是IO线程数*8
io: 4 # CPU有几核,就填写几。
servlet:
context-path: /undertow
@SpringBootApplication
public class AppRunning {
public static void main(String[] args) {
SpringApplication.run(AppRunning.class, args);
}
}
/**
* @description: 短连接HTTP层 RestFul API
* @author: GuoTong
* @createTime: 2023-05-16 21:31
* @since JDK 1.8 OR 11
**/
@RestController
@RequestMapping("restful")
public class BootStrapController {
@GetMapping("api")
public HashMap<String, String> hello() {
HashMap<String, String> map = new HashMap<>();
map.put("data", "很高兴认识你");
map.put("code", "200");
map.put("author", "郭童");
return map;
}
}
Maven实例:pom.xml文件中添加更换依赖 org.springframework.boot spring-boot-starter
出于对新工具和新技术的好奇,我开始尝试在deepin上用Fleet开发一个SpringBoot 3.0.0项目,继续我的SpringBoot学习。