Springboot1.5.21.RELEASE 升级至2.1.7.RELEASE

1、受Springboot版本升级影响的包

  • springboot 1.5.21.RELEASE
    • spring-boot-starter
    • spring-boot-starter-web
    • spring-boot-starter-test
    • spring-boot-devtools
    • spring-boot-starter-cache
    • spring-boot-starter-security
    • spring-boot-starter-aop
  • activiti 5.22.0
    • activiti-spring-boot-starter-basic
    • activiti-modeler
    • activiti-diagram-rest
  • druid-spring-boot-starter 1.1.6
  • jasypt-spring-boot-starter 1.13
  • google-gson 2.2.4

2、处理更新至2.1.7.RELEASE后项目爆红部分

2.1. 启动类SpringBootServletInitializer标红报错

import org.springframework.boot.web.support.SpringBootServletInitializer 过期

解决方式:import org.springframework.boot.web.servlet.support.SpringBootServletInitializer

2.2 @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) 找不到变量

解决方式:SecurityProperties no longer defines the ACCESS_OVERRIDE_ORDER constant for the @Order annotation. However, Spring Boot no longer defines any security details if the application does, so we do not need the @Order annotation on the security @Configuration class and can be removed.

3、启动项目报错

3.1 java.lang.IllegalStateException: Failed to introspect Class [com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure] from ClassLoader

解决方式:将druid升级至1.1.18

3.2 Failed to instantiate [org.springframework.validation.beanvalidation.MethodValidationPostProcessor]: Factory method 'methodValidationPostProcessor' threw exception; nested exception is java.lang.StackOverflowError

解决方式:将jasypt升级至2.1.1

3.3 The following method did not exist: com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder

解决方式:将google.gson升级至2.8.5

3.4 java.io.FileNotFoundException: class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class] cannot be opened because it does not exist 

解决方式:启动类增加注解 

@SpringBootApplication(exclude = {org.activiti.spring.boot.SecurityAutoConfiguration.class})

4、项目运行中功能出现兼容问题

4.1 SpringBoot2.0 从mysql 查询timestamp类型的字段时,会自动转换为UTC格式,并非之前的时间戳

解决方式:配置文件增加spring.jackson.serialization.write-dates-as-timestamps= true

4.2 文件上传大小配置更换,原配置方式:spring.http.multipart

解决方式:修改为spring.servlet.multipart

4.3 如果使用外置Tomcat,建议使用Tomcat 8.x以上版本,实际使用8.5.35运行正常

猜你喜欢

转载自blog.csdn.net/zszangy/article/details/100031933