I haven’t gotten my head wrapped around Spring yet, so correct me if this question doesn’t make sense…
I have a PropertyPlaceholderConfigurer
<bean id='rdbmPropertiesPlacholder' class='org.springframework.beans.factory.config.PropertyPlaceholderConfigurer' lazy-init='false'> <property name='location' value='classpath:/properties/rdbm.properties' /> </bean>
And I have a bean being injected I guess?
<bean id='PortalDb' class='org.apache.commons.dbcp.BasicDataSource'> <property name='driverClassName' value='${hibernate.connection.driver_class}' /> <property name='url' value='${hibernate.connection.url}' /> <property name='username' value='${hibernate.connection.username}' /> <property name='password' value='${hibernate.connection.password}' /> ...
What I want is a second placeholder pointing to a different properties file with the username/password so that I can split up the properties into two different files. Then the database connection information can be separate from the db username/password, and I can source control one and not the other.
I’ve tried basically copying the rdbmPropertiesPlaceholder with a different id and file and trying to access the properties, but it doesn’t work.
This code is from the uPortal open source web portal project.
Using this notation lets you specify multiple files:
The propertyplaceholderconfigurerer just merges all of these to look like there’s only one, so your bean definitions do not know where the properties come from.