# pom.xml 版本号升级
<spring.version_old>3.2.13.RELEASE</spring.version_old>
<spring.version>4.3.7.RELEASE</spring.version> <springsecurity.version_old>3.2.7.RELEASE</springsecurity.version_old>
<springsecurity.version>4.2.2.RELEASE</springsecurity.version>
# JUnit版本升级,4.12以上才行
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>`这里写代码片`
# Spring xml配置文件升级
spring-security 的xsd文件必须更新到4.2以上版本
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-4.2.xsd">
# 一些类名变更
org.springframework.web.servlet.view.json.MappingJacksonJsonView 变更为
org.springframework.web.servlet.view.json.MappingJackson2JsonView
org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy变更为
org.springframework.security.web.authentication.session.ConcurrentSessionControlAuthenticationStrategy
同一包下的其他文件也都做了类似的更名,参照修改。
hibernate-validator 要用 5.0.3.Final 版本与 javax.validator 1.1.0.Final对应使用,否则会报下面的错
java.lang.AbstractMethodError: org.hibernate.validator.internal.engine.ConfigurationImpl.getDefaultParameterNameProvider()Ljavax/validation/ParameterNameProvider
Jackson 版本升级 1.9.6 到 2.6.5
不升级会报下面的错
Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonGenerator
这个动静比较大,需要改很多处, 巨汗!
升级spring-test, 增加 @WebAppConfiguration 注解
不然的话会报类似
(“java.lang.IllegalStateException: WebApplicationObjectSupport instance [org.directwebremoting.spring.DwrController@xxx] does not run in a WebApplicationContext but in: org.springframework.context.support.GenericApplicationContext@xxx”). 的错
升级到servlet api 3.0.1
spring taglibs 升级
参考
http://stackoverflow.com/questions/10953194/equivalent-to-the-deprecated-secauthorize-ifnotgranted-attribute
ifNotGranted 和 ifAllGranted 已不能用
<sec:authorize ifNotGranted="ROLE_ACCOUNTS" ><img src="someimage.jpg"/></sec:authorize>
<sec:authorize ifAllGranted="ROLE_ACCOUNTS" ><a href="somelink.htm"><img src="someimage.jpg"/></a></sec:authorize>
要换成相关的access表达式
<sec:authorize access="!hasRole('ROLE_ACCOUNTS')">...</sec:authorize>
如果文件多,最好用正则表达式替换
查 sec:authorize\s+ifAnyGranted=”(\S+)”
换为 sec:authorize access=”hasRole(‘$1’)”
查 sec:authorize\s+ifNotGranted=”(\S+)”
换为 sec:authorize access=”!hasRole(‘$1’)”
升级并测试所有自己开发的jar包
一天时间不见得够 ;)
定时任务quartz 升级
使用新版本的定时任务:
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.1.7</version>
</dependency>
部分类名称改动: 在spring-context-support.jar里
CronTriggerBean 变成 CronTriggerFactoryBean
JobDetailBean 变成 JobDetailFactoryBean
org.springframework.scheduling.quartz.SimpleTriggerBean 变成了 org.springframework.scheduling.quartz.SimpleTriggerFactoryBean