PropertyPlaceholderConfigurer vs Filters -- Spring Beans
- by John
Hi there.
I've got a question regarding the difference between PropertyPlaceholderConfigurer (org.springframework.beans.factory.config.PropertyPlaceholderConfigurer) and normal filters defined in my pom.xml.
I've been looking at examples, and it seems that even though filters are defined and marked to be active by default in the pom.xml they still make use of PropertyPlaceholderConfigurer in Spring's applicationContext.xml.
This means that the pom.xml has a reference to a filter-LOCAL.properties while applicationContext.xml has a reference to application.properties and they both contain the same settings.
Why is that? Is that how it is supposed to be done? I'm able to run the goal mvn jetty:run without the application.properties present, but if I add settings to the application.properties that differ from the filter-LOCAL.properties they don't seem to override.
Here's an example of what I mean:
pom.xml
<profiles
<profile
<idLOCAL
<activation
<activeByDefaulttrue
</activation
<properties
<envLOCAL
</properties
</profile
</profiles
applicationContext.xml
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
<property name="locations"
<list
<valueclasspath:application.properties
</list
</property
<property name="ignoreResourceNotFound" value="true"/
</bean
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
<property name="driverClassName" value="${jdbc.driver}"/
<property name="url" value="${jdbc.url}"/
<property name="username" value="${jdbc.username}"/
<property name="password" value="${jdbc.password}"/
</bean
an example of the content of application.properties and filters-LOCAL.properties
jdbc.driver=org.postgresql.Driver
jdbc.url=jdbc:postgresql://localhost/shoutbox_dev
jdbc.username=tester
jdbc.password=tester
Can I remove the propertyConfigurer from the applicationContext, create a PROD filter and disregard the application.properties file, or will that give me issues when deploying to the production server?