A few days ago I thought it was time to upgrade my project to Spring 3.1. After all, the version 3.1 was stable enough after several bug fixes.
Upgrading to Spring 3.1 is very simple. You only need to update the Maven version and re-build it:
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>3.1.2.RELEASE</version>
- </dependency>
After re-compilation, you will find a lot of new warnings for discarded classes. For example, XmlBeanFactory has switched to defalistlistablebeanfactory instead:
- Resource resource = new ClassPathResource("example2.xml");
- return new XmlBeanFactory(resource);
Change:
- Resource resource = new ClassPathResource("example2.xml");
- DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
- BeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
- reader.loadBeanDefinitions(resource);
For a complete list of discarded classes, see
Http://www.osctools.net/uploads/apidocs/Spring-3.1.1/deprecated-list.html
Next, we need to change the XML Schema of Spring from 3.0 to 3.1, for example:
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
Changed:
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
The simplest way is to change-3.0.xsd to-3.1.xsd using global replacement in Eclipse, but check before replacement.
The purpose of Schema update is to use more new features of the new Spring version.
Link: http://www.oschina.net/question/54100_63771
Edit recommendations]