web容器使用undertow来代替tomcat

This commit is contained in:
dataprince 2023-07-12 07:08:04 +08:00
parent 4fa8b88c4a
commit f2150931ed
2 changed files with 27 additions and 11 deletions

View File

@ -22,16 +22,21 @@ server:
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
tomcat:
# tomcat的URI编码 # undertow web容器配置
uri-encoding: UTF-8 undertow:
# 连接数满后的排队数默认为100 # HTTP post内容的最大大小。当值为-1时默认值为大小是无限的
accept-count: 1000 max-http-post-size: -1
threads: # 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理
# tomcat最大线程数默认为200 # 每块buffer的空间大小,越小的空间被利用越充分
max: 800 buffer-size: 512
# Tomcat启动初始化的线程数默认值10 # 是否分配的直接内存
min-spare: 100 direct-buffers: true
threads:
# 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程
io: 8
# 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取得线程,它的值设置取决于系统的负载
worker: 256
# 日志配置 # 日志配置
logging: logging:

View File

@ -18,9 +18,20 @@
<dependencies> <dependencies>
<!-- SpringBoot Web容器 --> <!-- SpringBoot Web容器 -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<artifactId>spring-boot-starter-tomcat</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- undertow web 容器使用 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency> </dependency>
<!-- SpringBoot 拦截器 --> <!-- SpringBoot 拦截器 -->