I am using spring 3.1 with spring profiles to load beans. In my application context file, I load the following properties:
<context:property-placeholder order="1" location="classpath*:META-INF/spring/*_${spring.profiles.active}.properties" ignore-unresolvable="true"/>
And then I use the property value to load the bean data source like
<property name="driverClassName" value="${database.driverClassName}"/>
It works great. The problem starts when I add a few extra property placeholders so that you can load properties from some database tables.
It uses a link to properties loaded
<bean id="configFactoryBean" class="org.springmodules.commons.configuration.CommonsConfigurationFactoryBean"> <constructor-arg ref="globalSystemConfiguration"/> </bean>
To add to the details, this configFactoryBean uses a datasource to load properties from the database.
When I do this, I have the following exception:
java.lang.ClassNotFoundException: ${database.driverClassName}
My analysis is that it tries to load the datasource before resolving the property from the first placeholder of the context property. Maybe I'm wrong. Or perhaps the spring profile variable is not resolved properly.
Can anyone help me fix this.
Thanks Akki
java spring spring-mvc hibernate
Abby Jun 03 '13 at 8:31 on 2013-06-03 08:31
source share