From f35236609ca0ffc6fe63a7efb751991f356cc3cc Mon Sep 17 00:00:00 2001 From: zhangdaiscott Date: Mon, 25 Jan 2021 11:43:50 +0800 Subject: [PATCH] =?UTF-8?q?TomcatServletWebServerFactory=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/JeecgSystemApplication.java | 19 ----------- .../config/init/TomcatFactoryConfig.java | 33 +++++++++++++++++++ .../jeecg/JeecgSystemCloudApplication.java | 13 -------- 3 files changed, 33 insertions(+), 32 deletions(-) create mode 100644 jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/config/init/TomcatFactoryConfig.java diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/JeecgSystemApplication.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/JeecgSystemApplication.java index 1930bf8..c38656f 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/JeecgSystemApplication.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/JeecgSystemApplication.java @@ -40,24 +40,5 @@ public class JeecgSystemApplication extends SpringBootServletInitializer { "External: \thttp://" + ip + ":" + port + path + "/\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + "----------------------------------------------------------"); - - } - - /** - * tomcat-embed-jasper引用后提示jar找不到的问题 - */ - @Bean - public TomcatServletWebServerFactory tomcatFactory() { - TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory() { - @Override - protected void postProcessContext(Context context) { - ((StandardJarScanner) context.getJarScanner()).setScanManifest(false); - } - }; - factory.addConnectorCustomizers(connector -> { - connector.setProperty("relaxedPathChars", "[]{}"); - connector.setProperty("relaxedQueryChars", "[]{}"); - }); - return factory; } } \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/config/init/TomcatFactoryConfig.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/config/init/TomcatFactoryConfig.java new file mode 100644 index 0000000..ac4d2a5 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/config/init/TomcatFactoryConfig.java @@ -0,0 +1,33 @@ +package org.jeecg.config.init; + +import org.apache.catalina.Context; +import org.apache.tomcat.util.scan.StandardJarScanner; +import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @Description: TomcatFactoryConfig + * @author: scott + * @date: 2021年01月25日 11:40 + */ +@Configuration +public class TomcatFactoryConfig { + /** + * tomcat-embed-jasper引用后提示jar找不到的问题 + */ + @Bean + public TomcatServletWebServerFactory tomcatFactory() { + TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory() { + @Override + protected void postProcessContext(Context context) { + ((StandardJarScanner) context.getJarScanner()).setScanManifest(false); + } + }; + factory.addConnectorCustomizers(connector -> { + connector.setProperty("relaxedPathChars", "[]{}"); + connector.setProperty("relaxedQueryChars", "[]{}"); + }); + return factory; + } +} diff --git a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/JeecgSystemCloudApplication.java b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/JeecgSystemCloudApplication.java index 4ac909b..f40b5f9 100644 --- a/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/JeecgSystemCloudApplication.java +++ b/jeecg-boot/jeecg-cloud-module/jeecg-cloud-system-start/src/main/java/org/jeecg/JeecgSystemCloudApplication.java @@ -45,17 +45,4 @@ public class JeecgSystemCloudApplication extends SpringBootServletInitializer { "----------------------------------------------------------"); } - - /** - * tomcat-embed-jasper引用后提示jar找不到的问题 - */ - @Bean - public TomcatServletWebServerFactory tomcatFactory() { - return new TomcatServletWebServerFactory() { - @Override - protected void postProcessContext(Context context) { - ((StandardJarScanner) context.getJarScanner()).setScanManifest(false); - } - }; - } } \ No newline at end of file -- GitLab