随着Spring4.0的发布,很多同志估计都在考虑升级的事情了吧, 在前一篇(
http://ningandjiao.iteye.com/admin/blogs/1993481
)中讲了Spring4.0给我们带来的新特性,如果真的非常喜欢的话,接下来就来看看升级注意事项,帮助想升级的同志们估算一下自己在自己的项目中升级到Spring 4.0的成本。
https://github.com/spring-projects/spring-framework/wiki/Migrating-from-earlier-versions-of-the-spring-framework
1. JDK最低版本:JDK6 update 10。
2. 支持的最低JAVA规范更新:
Servlet 3.0 (2.5 supported for deployment)
JPA 2.0
Bean Validation 1.0
JSF 2.0
JCache 1.0 PFD
JDO 3.0
3. Web服务器支持的最低版本更新:
Tomcat 6.0.30
Jetty 7.3
JBoss AS 6.0
GlassFish 3.1
Oracle WebLogic 10.3.4 (with JPA 2.0 patch applied)
IBM WebSphere 7.0.0.9 (with JPA 2.0 feature pack installed)
如果你想要使用完全的Servlet3.0特性,下面这些版本的容器完全兼容Servlet 3.0规范
Tomcat 7.x,
Glassfish 3.x,
JBoss AS 6.x/7.x
Jetty 8.x.
4. 一些集成的第三方库最低版本更新:
Hibernate Validator 4.3
Hibernate 3.6 (4.2 recommended)
EhCache 2.1 (2.5+ recommended)
Quartz 1.8 (2.2 recommended)
Jackson 1.8 (2.2 recommended)
Groovy 1.8 (2.2 recommended)
Joda-Time 2.0 (2.3 recommended)
Hessian 4.0
XStream 1.4
Apache POI 3.5
5. 不推荐使用的类和方法
Jackson 1:
MappingJacksonMessageConverter
JacksonObjectMapperFactoryBean
MappingJacksonHttpMessageConverte
GenericTypeResolver:
GenericTypeResolver.getTargetType(MethodParameter methodParam)
GenericTypeResolver.resolveType(Type genericType, Map<TypeVariable, Type> map)
GenericTypeResolver.getTypeVariableMap(Class<?> clazz)
Burlap:
BurlapClientInterceptor
BurlapExporter
BurlapProxyFactoryBean
BurlapServiceExporter
SimpleBurlapServiceExporter
Jboss Classes:
JBossWorkManagerTaskExecutor
JBossWorkManagerUtils
Others:
AbstractJaxWsServiceExporter.setWebServiceFeatures(Object[] webServiceFeatures)
JaxWsPortClientInterceptor.setWebServiceFeatures(Object[] webServiceFeatures)
DefaultKeyGenerator
6. MVC namespace和schema更新,修改了2个属性的名:
enableMatrixVariables -> enable-matrix-variables
ignoreDefaultModelOnRedirect -> ignore-default-model-on-redirect
总的来看,如果JDK和Web Container没有问题的话,升级成本还是比较低的
https://github.com/spring-projects/spring-framework/wiki/Migrating-from-earlier-versions-of-the-spring-framework
1. JDK最低版本:JDK6 update 10。
2. 支持的最低JAVA规范更新:
Servlet 3.0 (2.5 supported for deployment)
JPA 2.0
Bean Validation 1.0
JSF 2.0
JCache 1.0 PFD
JDO 3.0
3. Web服务器支持的最低版本更新:
Tomcat 6.0.30
Jetty 7.3
JBoss AS 6.0
GlassFish 3.1
Oracle WebLogic 10.3.4 (with JPA 2.0 patch applied)
IBM WebSphere 7.0.0.9 (with JPA 2.0 feature pack installed)
如果你想要使用完全的Servlet3.0特性,下面这些版本的容器完全兼容Servlet 3.0规范
Tomcat 7.x,
Glassfish 3.x,
JBoss AS 6.x/7.x
Jetty 8.x.
4. 一些集成的第三方库最低版本更新:
Hibernate Validator 4.3
Hibernate 3.6 (4.2 recommended)
EhCache 2.1 (2.5+ recommended)
Quartz 1.8 (2.2 recommended)
Jackson 1.8 (2.2 recommended)
Groovy 1.8 (2.2 recommended)
Joda-Time 2.0 (2.3 recommended)
Hessian 4.0
XStream 1.4
Apache POI 3.5
5. 不推荐使用的类和方法
Jackson 1:
MappingJacksonMessageConverter
JacksonObjectMapperFactoryBean
MappingJacksonHttpMessageConverte
GenericTypeResolver:
GenericTypeResolver.getTargetType(MethodParameter methodParam)
GenericTypeResolver.resolveType(Type genericType, Map<TypeVariable, Type> map)
GenericTypeResolver.getTypeVariableMap(Class<?> clazz)
Burlap:
BurlapClientInterceptor
BurlapExporter
BurlapProxyFactoryBean
BurlapServiceExporter
SimpleBurlapServiceExporter
Jboss Classes:
JBossWorkManagerTaskExecutor
JBossWorkManagerUtils
Others:
AbstractJaxWsServiceExporter.setWebServiceFeatures(Object[] webServiceFeatures)
JaxWsPortClientInterceptor.setWebServiceFeatures(Object[] webServiceFeatures)
DefaultKeyGenerator
6. MVC namespace和schema更新,修改了2个属性的名:
enableMatrixVariables -> enable-matrix-variables
ignoreDefaultModelOnRedirect -> ignore-default-model-on-redirect
总的来看,如果JDK和Web Container没有问题的话,升级成本还是比较低的