Merge pull request #5716 from EightMonth/springboot3

升级fastjson至2.0.43,替换tomcat为undertow
pull/5765/head
JEECG 2023-12-26 17:21:30 +08:00 committed by GitHub
commit b5fd5fe782
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 85 additions and 45 deletions

View File

@ -53,6 +53,16 @@
<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>
<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> </dependency>
<!-- websocket --> <!-- websocket -->
<dependency> <dependency>

View File

@ -413,7 +413,7 @@ public class oConvertUtils {
return false; return false;
} }
String[] childs = childArray.toArray(new String[]{}); String[] childs = (String[]) childArray.toArray();
for (String v : childs) { for (String v : childs) {
if (!isIn(v, all)) { if (!isIn(v, all)) {
return false; return false;

View File

@ -15,10 +15,6 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author kezhijie@wuhandsj.com
* @date 2023/11/2 14:19
*/
@Configuration @Configuration
public class Swagger3Config implements WebMvcConfigurer { public class Swagger3Config implements WebMvcConfigurer {
/** /**

View File

@ -0,0 +1,19 @@
package org.jeecg.config;
import io.undertow.server.DefaultByteBufferPool;
import io.undertow.websockets.jsr.WebSocketDeploymentInfo;
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.stereotype.Component;
@Component
public class UndertowCustomizer implements WebServerFactoryCustomizer<UndertowServletWebServerFactory> {
@Override
public void customize(UndertowServletWebServerFactory factory) {
factory.addDeploymentInfoCustomizers(deploymentInfo -> {
WebSocketDeploymentInfo webSocketDeploymentInfo = new WebSocketDeploymentInfo();
webSocketDeploymentInfo.setBuffers(new DefaultByteBufferPool(false, 1024));
deploymentInfo.addServletContextAttribute("io.undertow.websockets.jsr.WebSocketDeploymentInfo", webSocketDeploymentInfo);
});
}
}

View File

@ -1,33 +1,33 @@
package org.jeecg.config.init; //package org.jeecg.config.init;
//
import org.apache.catalina.Context; //import org.apache.catalina.Context;
import org.apache.tomcat.util.scan.StandardJarScanner; //import org.apache.tomcat.util.scan.StandardJarScanner;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; //import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Configuration;
//
/** ///**
* @Description: TomcatFactoryConfig // * @Description: TomcatFactoryConfig
* @author: scott // * @author: scott
* @date: 20210125 11:40 // * @date: 2021年01月25日 11:40
*/ // */
@Configuration //@Configuration
public class TomcatFactoryConfig { //public class TomcatFactoryConfig {
/** // /**
* tomcat-embed-jasperjar // * tomcat-embed-jasper引用后提示jar找不到的问题
*/ // */
@Bean // @Bean
public TomcatServletWebServerFactory tomcatFactory() { // public TomcatServletWebServerFactory tomcatFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory() { // TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory() {
@Override // @Override
protected void postProcessContext(Context context) { // protected void postProcessContext(Context context) {
((StandardJarScanner) context.getJarScanner()).setScanManifest(false); // ((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
} // }
}; // };
factory.addConnectorCustomizers(connector -> { // factory.addConnectorCustomizers(connector -> {
connector.setProperty("relaxedPathChars", "[]{}"); // connector.setProperty("relaxedPathChars", "[]{}");
connector.setProperty("relaxedQueryChars", "[]{}"); // connector.setProperty("relaxedQueryChars", "[]{}");
}); // });
return factory; // return factory;
} // }
} //}

View File

@ -1,7 +1,12 @@
server: server:
port: 8080 port: 8080
tomcat: undertow:
max-swallow-size: -1 # 平替 tomcat server.tomcat.max-swallow-siz undertow该值默认为-1
# max-http-post-size: 10MB
worker-threads: 16 # 4核CPU标准配置
buffers:
websocket: 8192 # WebSocket缓冲 以字节为单位这里设置为8 KB
io: 16384 # IO操作缓冲 以字节为单位这里设置为16 KB
error: error:
include-exception: true include-exception: true
include-stacktrace: ALWAYS include-stacktrace: ALWAYS

View File

@ -1,7 +1,12 @@
server: server:
port: 8080 port: 8080
tomcat: undertow:
max-swallow-size: -1 # 平替 tomcat server.tomcat.max-swallow-siz undertow该值默认为-1
# max-http-post-size: 10MB
worker-threads: 16 # 4核CPU标准配置
buffers:
websocket: 8192 # WebSocket缓冲 以字节为单位这里设置为8 KB
io: 16384 # IO操作缓冲 以字节为单位这里设置为16 KB
error: error:
include-exception: true include-exception: true
include-stacktrace: ALWAYS include-stacktrace: ALWAYS

View File

@ -1,7 +1,12 @@
server: server:
port: 8080 port: 8080
tomcat: undertow:
max-swallow-size: -1 # 平替 tomcat server.tomcat.max-swallow-siz undertow该值默认为-1
# max-http-post-size: 10MB
worker-threads: 16 # 4核CPU标准配置
buffers:
websocket: 8192 # WebSocket缓冲 以字节为单位这里设置为8 KB
io: 16384 # IO操作缓冲 以字节为单位这里设置为16 KB
error: error:
include-exception: true include-exception: true
include-stacktrace: ALWAYS include-stacktrace: ALWAYS

View File

@ -38,7 +38,7 @@
<alibaba.nacos.version>2.0.4</alibaba.nacos.version> <alibaba.nacos.version>2.0.4</alibaba.nacos.version>
<xxl-job-core.version>2.2.0</xxl-job-core.version> <xxl-job-core.version>2.2.0</xxl-job-core.version>
<fastjson.version>1.2.83</fastjson.version> <fastjson.version>2.0.43</fastjson.version>
<pegdown.version>1.6.0</pegdown.version> <pegdown.version>1.6.0</pegdown.version>
<knife4j-spring-boot-starter.version>4.3.0</knife4j-spring-boot-starter.version> <knife4j-spring-boot-starter.version>4.3.0</knife4j-spring-boot-starter.version>
<knife4j-spring-ui.version>2.0.9</knife4j-spring-ui.version> <knife4j-spring-ui.version>2.0.9</knife4j-spring-ui.version>