升级 spring 3.0 前要准备的一些工作
0:
清除掉所有的对 spring framework 低版本 的 显示引用。
1, javax –> j2ee
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
</dependency>
2,
import org.thymeleaf.spring5.SpringTemplateEngine;
->
import org.thymeleaf.spring6.SpringTemplateEngine;
3,
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
->
import org.springframework.web.servlet.HandlerInterceptor;
..
extends HandlerInterceptorAdapter =>implements HandlerInterceptor
4,
spring.redis.* => spring.data.redis.*
5,
mybatis-spring-boot-starter --> 3.0.1
6,
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>9.2.0.jre8</version>
</dependency>
升级 11.2.2.jre17 还需要考虑,会导致SSL 错误
解决:jdbc:sqlserver://ipipip:1433;DatabaseName=dbname;encrypt=false;
7, 兼容 url/a 与 url/a/
@Configuration
public class TrailingSlashWebConfiguration implements WebMvcConfigurer {
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer.setUseTrailingSlashMatch(true);
}
}
8, META-INF/spring.factories -> META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
参考:
1, 重点 Url /
https://www.51cto.com/article/741992.html