Upgrade from Spring 3.0 to Spring 3.1

Source: Internet
Author: User

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:

 
 
  1. <dependency>  
  2.     <groupId>org.springframework</groupId>  
  3.     <artifactId>spring-core</artifactId>  
  4.     <version>3.1.2.RELEASE</version>  
  5. </dependency> 

After re-compilation, you will find a lot of new warnings for discarded classes. For example, XmlBeanFactory has switched to defalistlistablebeanfactory instead:

 
 
  1. Resource resource = new ClassPathResource("example2.xml");  
  2. return new XmlBeanFactory(resource); 

Change:

 
 
  1. Resource resource = new ClassPathResource("example2.xml");  
  2. DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();  
  3. BeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);  
  4. 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:

 
 
  1. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 

Changed:

 
 
  1. 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]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.