Announcement Announcement Module
Collapse
No announcement yet.
**HELP** Migrate from Spring 2.5 to Spring 3.0.5 **HELP** Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • **HELP** Migrate from Spring 2.5 to Spring 3.0.5 **HELP**

    Hi all!

    I'm migrating my web app from JSF 1.x and Spring 2.5 to JSF 2 and Spring 3.0.5

    I load properties from DB and file.
    I have this configuration for Spring 2.5:

    applicaztion-context.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <beans xmlns="http://www.springframework.org/schema/beans"
    	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	   xmlns:aop="http://www.springframework.org/schema/aop"
    	   xmlns:tx="http://www.springframework.org/schema/tx"
    	   xsi:schemaLocation="http://www.springframework.org/schema/beans 
    						   http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
    						   http://www.springframework.org/schema/tx 
    						   http://www.springframework.org/schema/tx/spring-tx-2.0.xsd 
    						   http://www.springframework.org/schema/aop 
    						   http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
    	
    <!-- PROPERTIES BEAN FROM DB -->	
    	<bean id="goWebPropertiesFromDB" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        	<property name="properties" ref="goWebCommonsConfigurationFactoryBean" />
    	</bean>
    	
    	<bean class="it.niuma.goWeb.goWebOrderedPropertyPlaceholderConfigurer.GOWebOrderedPropertyPlaceholderConfigurer">
        	<constructor-arg ref="goWebPropertiesFromDB" />
    	</bean>
      	
    	<bean name="goWebCommonsConfigurationFactoryBean" class="org.springmodules.commons.configuration.CommonsConfigurationFactoryBean">
           <constructor-arg ref="goWebDatabaseConfiguration"/>
    	</bean>
    	
    	<bean name="goWebDatabaseConfiguration" class="org.apache.commons.configuration.DatabaseConfiguration">
            <constructor-arg>
       			<bean id="ds1" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
         			<property name="driverClassName" >
         				<value>${database.driver}</value>
    				</property>
         			<property name="url">
         				<value>${database.url}</value>
         			</property>
         			<property name="username">
         				<value>${database.user}</value>
         			</property>
         			<property name="password">
         				<value>${database.password}</value>
         			</property>     			
       			</bean>
       		</constructor-arg>
            <constructor-arg index="1" value="UTENTERFX.RFX_PROPERTIES_TABLE"/>
            <constructor-arg index="2" value="PROPERTY_KEY"/>
            <constructor-arg index="3" value="PROPERTY_VALUE"/>
    	</bean>
    	
    	<!-- PROPERTIES BEAN FROM FILE -->
    	<bean id="goWebPropertiesFromFile" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
      		<property name="ignoreUnresolvablePlaceholders" value="true"/>
     		<property name="location" value="classpath:GOWeb.properties"/>
    	</bean>
    </beans>
    GOWebOrderedPropertyPlaceholderConfigurer.java
    Code:
    package it.niuma.goWeb.goWebOrderedPropertyPlaceholderConfigurer;
    
    import java.util.Properties;
    
    import org.springframework.beans.BeansException;
    import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
    import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
    import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
    import org.springframework.core.Ordered;
    
    public class GOWebOrderedPropertyPlaceholderConfigurer implements Ordered, BeanFactoryPostProcessor {
    
    	private Properties properties;	
    	private int order = 0;
    	
    	public GOWebOrderedPropertyPlaceholderConfigurer(Properties properties) {
    		this.properties = properties;
    	}
    	
    	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    		PropertyPlaceholderConfigurer bfPostProcessor = new PropertyPlaceholderConfigurer();
    		bfPostProcessor.setProperties(properties);
    		bfPostProcessor.postProcessBeanFactory(beanFactory);
    	}	
    	
    	public int getOrder() {
    		return order;
    	}
    	
    	public void setOrder(int order) {
    		this.order = order;
    	}
    }
    I changed spring jars and I have some problems because Ordered, ConfigurableListableBeanFactory, PropertyPlaceholderConfigurer, etc are not founded.

    I searched the solution on internet and spring documentation but, at this time, I'm so confused

    Can anyone help me, please?

    Thanks in advance for any suggestions!!!!

    Cheers, Valentina

  • #2
    If they aren't found you are missing jars... Include all the jars you need (probably at least beans, core, util, context). I suggest using maven or ant/ivy to manage your dependencies, saves you a lot of headaches (and will probably give you a couple new ).

    Also fix your xsd they still point to 2.0 versions instead of 3.0 versions..

    Comment


    • #3
      Marten, thanks for your help!

      You're right....I missed a couple of jars
      The properties problem is solved!

      I posted a new thread for DI problems...I hope you can give me help...

      Have a nice day!
      Bye, Vale

      Comment

      Working...
      X