mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 10:57:13 +08:00 
			
		
		
		
	优化:移除内置 Tomcat 服务器,集成 Undertow 服务器(采用 Java 开发的灵活的高性能 Web 服务器,提供包括阻塞和基于 NIO 的非堵塞机制)
This commit is contained in:
		| @@ -5,13 +5,14 @@ | |||||||
|  |  | ||||||
| ### 简介 | ### 简介 | ||||||
|  |  | ||||||
| ContiNew-Admin (incubating) 中后台管理框架,Continue New Admin,持续以最新流行技术栈构建。当前阶段采用的技术栈:Spring Boot 等。 | ContiNew-Admin (incubating) 中后台管理框架,Continue New Admin,持续以最新流行技术栈构建。当前阶段采用的技术栈:Spring Boot、Undertow 等。 | ||||||
|  |  | ||||||
| ### 技术栈 | ### 技术栈 | ||||||
|  |  | ||||||
| | 名称                                                  | 版本         | 简介                                                         | | | 名称                                                  | 版本         | 简介                                                         | | ||||||
| | ----------------------------------------------------- | ------- | ------------------------------------------------------------ | | | ----------------------------------------------------- | ------------ | ------------------------------------------------------------ | | ||||||
| | [Spring Boot](https://spring.io/projects/spring-boot) | 2.7.6        | 简化新 Spring 应用的初始搭建以及开发过程。                   | | | [Spring Boot](https://spring.io/projects/spring-boot) | 2.7.6        | 简化新 Spring 应用的初始搭建以及开发过程。                   | | ||||||
|  | | [Undertow](https://undertow.io/)                      | 2.2.20.Final | 采用 Java 开发的灵活的高性能 Web 服务器,提供包括阻塞和基于 NIO 的非堵塞机制。 | | ||||||
| | [Lombok](https://projectlombok.org/)                  | 1.18.24      | 在 Java 开发过程中用注解的方式,简化了 JavaBean 的编写,避免了冗余和样板式代码,让编写的类更加简洁。 | | | [Lombok](https://projectlombok.org/)                  | 1.18.24      | 在 Java 开发过程中用注解的方式,简化了 JavaBean 的编写,避免了冗余和样板式代码,让编写的类更加简洁。 | | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										20
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								pom.xml
									
									
									
									
									
								
							| @@ -33,6 +33,26 @@ | |||||||
|         <dependency> |         <dependency> | ||||||
|             <groupId>org.springframework.boot</groupId> |             <groupId>org.springframework.boot</groupId> | ||||||
|             <artifactId>spring-boot-starter-web</artifactId> |             <artifactId>spring-boot-starter-web</artifactId> | ||||||
|  |             <!-- 移除内置 Tomcat 服务器 --> | ||||||
|  |             <exclusions> | ||||||
|  |                 <exclusion> | ||||||
|  |                     <groupId>org.springframework.boot</groupId> | ||||||
|  |                     <artifactId>spring-boot-starter-tomcat</artifactId> | ||||||
|  |                 </exclusion> | ||||||
|  |             </exclusions> | ||||||
|  |         </dependency> | ||||||
|  |  | ||||||
|  |         <!-- Undertow 服务器(采用 Java 开发的灵活的高性能 Web 服务器,提供包括阻塞和基于 NIO 的非堵塞机制) --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.springframework.boot</groupId> | ||||||
|  |             <artifactId>spring-boot-starter-undertow</artifactId> | ||||||
|  |             <!-- 移除 websocket 依赖,后续使用 websocket 可考虑由 Netty 提供。另可解决日志警告:UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used --> | ||||||
|  |             <exclusions> | ||||||
|  |                 <exclusion> | ||||||
|  |                     <groupId>io.undertow</groupId> | ||||||
|  |                     <artifactId>undertow-websockets-jsr</artifactId> | ||||||
|  |                 </exclusion> | ||||||
|  |             </exclusions> | ||||||
|         </dependency> |         </dependency> | ||||||
|  |  | ||||||
|         <dependency> |         <dependency> | ||||||
|   | |||||||
| @@ -20,6 +20,20 @@ server: | |||||||
|   servlet: |   servlet: | ||||||
|     # 应用访问路径 |     # 应用访问路径 | ||||||
|     context-path: / |     context-path: / | ||||||
|  |   ## Undertow 服务器配置 | ||||||
|  |   undertow: | ||||||
|  |     # HTTP POST 请求内容的大小上限(默认 -1 不限制) | ||||||
|  |     max-http-post-size: -1 | ||||||
|  |     # 以下的配置会影响 buffer,这些 buffer 会用于服务器连接的 IO 操作,有点类似 Netty 的池化内存管理 | ||||||
|  |     # 每块 buffer的空间大小(越小的空间被利用越充分,不要设置太大,以免影响其他应用,合适即可) | ||||||
|  |     buffer-size: 512 | ||||||
|  |     # 是否分配的直接内存(NIO 直接分配的堆外内存) | ||||||
|  |     direct-buffers: true | ||||||
|  |     threads: | ||||||
|  |       # 设置 IO 线程数,它主要执行非阻塞的任务,它们会负责多个连接(默认每个 CPU 核心一个线程) | ||||||
|  |       io: 8 | ||||||
|  |       # 阻塞任务线程池,当执行类似 Servlet 请求阻塞操作,Undertow 会从这个线程池中取得线程(它的值设置取决于系统的负载) | ||||||
|  |       worker: 256 | ||||||
|  |  | ||||||
| --- ### Spring 配置 | --- ### Spring 配置 | ||||||
| spring: | spring: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user