Hi,
I'm trying to use two PropertyPlaceholderConfigurers but I'm getting a BeanDefinitionStoreException each time I try to read a value from the second one.
I've the following web.xml entry:
In menuContext.xml:Code:<context-param> <param-name> contextConfigLocation </param-name> <param-value> /WEB-INF/menuContext.xml, /WEB-INF/appContext.xml </param-value> </context-param>
in appContext.xml:Code:<bean id="menuPropertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"> <value>classpath:menu.properties</value> </property> </bean>
Using this configuration I can't read any property from project.properties.Code:<bean id="projectPropertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"> <value>classpath:project.properties</value> </property> </bean>
If I switch the order in web.xml:
I can't read any data from menu.properties.Code:<context-param> <param-name> contextConfigLocation </param-name> <param-value> /WEB-INF/appContext.xml, /WEB-INF/menuContext.xml </param-value> </context-param>
The trace I get in the first case is:
Here appDataSource is the bean that tries to use ${aplication.driver}Code:[SPRING] 17:25:28 DEBUG BeanWrapperImpl : 997 - Converting String to [interface org.springframework.core.io.Resource] using property editor [org.springframework.core.io.ResourceEditor@9ac0f5] [SPRING] 17:25:28 DEBUG BeanWrapperImpl : 829 - About to invoke write method [public void org.springframework.core.io.support.PropertiesLoaderSupport.setLocation(org.springframework.core.io.Resource)] on object of class [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] [SPRING] 17:25:28 DEBUG BeanWrapperImpl : 834 - Invoked write method [public void org.springframework.core.io.support.PropertiesLoaderSupport.setLocation(org.springframework.core.io.Resource)] with value of type [org.springframework.core.io.Resource] [SPRING] 17:25:28 DEBUG DefaultListableBeanFactory : 344 - Invoking setBeanName on BeanNameAware bean 'projectPropertyConfigurer' [SPRING] 17:25:28 DEBUG DefaultListableBeanFactory : 351 - Invoking setBeanFactory on BeanFactoryAware bean 'projectPropertyConfigurer' [SPRING] 17:25:28 DEBUG DefaultListableBeanFactory : 235 - Invoking BeanPostProcessors before initialization of bean 'projectPropertyConfigurer' [SPRING] 17:25:28 DEBUG DefaultListableBeanFactory : 254 - Invoking BeanPostProcessors after initialization of bean 'projectPropertyConfigurer' [SPRING] 17:25:28 INFO PropertyPlaceholderConfigurer : 167 - Loading properties file from class path resource [menu.properties] [SPRING] 17:25:28 ERROR ContextLoader : 177 - Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'appDataSource' defined in ServletContext resource [/WEB-INF/appContext.xml]: Could not resolve placeholder 'aplication.driver'
I've been trying several things with the names and the declarations without success. I looked for something like this in Jira without success (so this means I'm doing something wrong).
Any comment here would be really welcome.
Regards,
- Juan


Reply With Quote