Skip to content

Commit e462beb

Browse files
committed
rollback spring version
1 parent 46a029d commit e462beb

File tree

4 files changed

+31
-25
lines changed

4 files changed

+31
-25
lines changed

publiccms-parent/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ subprojects {
3232
servletVersion = "6.1.0"
3333
// http://mvnrepository.com/artifact/org.springframework/spring-core
3434
// https://spring.io/projects/spring-framework
35-
springVersion = "7.0.1"
35+
springVersion = "6.2.12"
3636
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web
3737
// https://spring.io/projects/spring-boot
38-
springBootVersion = "4.0.0"
38+
springBootVersion = "3.5.6"
3939
// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine
4040
junitVersion = "6.0.1"
4141
// http://mvnrepository.com/artifact/org.hibernate.orm/hibernate-core

publiccms-parent/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
<version.servlet>6.1.0</version.servlet>
2727
<!-- http://mvnrepository.com/artifact/org.springframework/spring-core -->
2828
<!-- https://spring.io/projects/spring-framework -->
29-
<version.spring>7.0.1</version.spring>
29+
<version.spring>6.2.12</version.spring>
3030
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
3131
<!-- https://spring.io/projects/spring-boot -->
32-
<version.springBoot>4.0.0</version.springBoot>
32+
<version.springBoot>3.5.6</version.springBoot>
3333
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine -->
3434
<version.juint>6.0.1</version.juint>
3535
<!-- http://mvnrepository.com/artifact/org.hibernate.orm/hibernate-core -->

publiccms-parent/publiccms/src/main/java/boot/SpringBootApplication.java

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55

66
import org.apache.catalina.valves.RemoteIpValve;
77
import org.springframework.boot.SpringApplication;
8-
import org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory;
9-
import org.springframework.boot.web.error.ErrorPage;
10-
import org.springframework.boot.web.server.servlet.ServletWebServerFactory;
8+
import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
9+
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
10+
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
11+
import org.springframework.boot.web.server.ErrorPage;
1112
import org.springframework.boot.web.servlet.ServletContextInitializer;
13+
import org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory;
14+
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
1215
import org.springframework.context.annotation.Bean;
1316
import org.springframework.context.annotation.Configuration;
1417
import org.springframework.context.annotation.Import;
@@ -34,16 +37,10 @@
3437
public class SpringBootApplication {
3538

3639
/**
37-
* <p>
38-
* 在idea中通过main方法启动需要将工作目录改为 publiccms 模块所在的路径,否则静态资源不能加载
39-
* <p>
40-
* ideaのmainメソッドから始めるには、作業ディレクトリをpubliccmsモジュールが配置されているパスに変更する必要があり、そうしないと静的リソースをロードできません
41-
* <p>
42-
* To start through the main method in idea, you need to change the working
43-
* directory to the path where the publiccms module is located, otherwise
44-
* the static resources cannot be loaded
45-
* <p>
46-
* https://www.publiccms.com/question/2018/02-13/376.html
40+
* <p>在idea中通过main方法启动需要将工作目录改为 publiccms 模块所在的路径,否则静态资源不能加载
41+
* <p>ideaのmainメソッドから始めるには、作業ディレクトリをpubliccmsモジュールが配置されているパスに変更する必要があり、そうしないと静的リソースをロードできません
42+
* <p>To start through the main method in idea, you need to change the working directory to the path where the publiccms module is located, otherwise the static resources cannot be loaded
43+
* <p>https://www.publiccms.com/question/2018/02-13/376.html
4744
*
4845
* @param args
4946
*/
@@ -56,10 +53,19 @@ public static void main(String[] args) {
5653
*/
5754
@Bean
5855
public ServletWebServerFactory servletContainer() {
59-
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
60-
String initProto = System.getProperty("cms.initProto");
61-
if (CommonUtils.notEmpty(initProto) && "false".equalsIgnoreCase(initProto)) {
62-
factory.addEngineValves(new RemoteIpValve());
56+
String server = System.getProperty("cms.server");
57+
AbstractServletWebServerFactory factory = null;
58+
if ("jetty".equalsIgnoreCase(server)) {
59+
factory = new JettyServletWebServerFactory();
60+
} else if ("undertow".equalsIgnoreCase(server)) {
61+
factory = new UndertowServletWebServerFactory();
62+
} else {
63+
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
64+
String initProto = System.getProperty("cms.initProto");
65+
if (CommonUtils.notEmpty(initProto) && "false".equalsIgnoreCase(initProto)) {
66+
tomcat.addEngineValves(new RemoteIpValve());
67+
}
68+
factory = tomcat;
6369
}
6470
Set<ErrorPage> errorPageSet = factory.getErrorPages();
6571
errorPageSet.add(new ErrorPage(Throwable.class, "/error/500.html"));
@@ -71,8 +77,8 @@ public ServletWebServerFactory servletContainer() {
7177
factory.setContextPath(System.getProperty("cms.contextPath", ""));
7278
factory.setDisplayName("PublicCMS");
7379
factory.setRegisterDefaultServlet(true);
74-
factory.getSettings().getSession().setTimeout(Duration.ofMinutes(20));
75-
factory.getSettings().getJsp().setRegistered(false);
80+
factory.getSession().setTimeout(Duration.ofMinutes(20));
81+
factory.getJsp().setRegistered(false);
7682
return factory;
7783
}
7884

publiccms-parent/publiccms/src/main/java/config/spring/ApplicationConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
import org.springframework.core.env.Environment;
2626
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
2727
import org.springframework.core.io.support.PropertiesLoaderUtils;
28-
import org.springframework.orm.jpa.hibernate.HibernateTransactionManager;
29-
import org.springframework.orm.jpa.hibernate.LocalSessionFactoryBean;
28+
import org.springframework.orm.hibernate5.HibernateTransactionManager;
29+
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
3030
import org.springframework.scheduling.annotation.EnableScheduling;
3131
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
3232
import org.springframework.stereotype.Controller;

0 commit comments

Comments
 (0)