Search code examples
javaspringmavenapplicationcontext

${project.name} lost when using PropertyPlaceholderConfigurer


I'm using Maven to build a Spring (3.0.5.RELEASE) project. In my applicationContext.xml I use PropertyPlaceholderConfigurer (to load properties from the DB) like so:

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="properties" ref="configurationConverter"/>
</bean>

The properties I want to access in the DB works fine, but ${project.name} and ${project.version} stops working. Where do these properties come from originally? And most importantly: how can I get them back?


Solution

  • If you use the Maven Resources plugin and set filtering=true, then you can replace Maven variables like 'project.version'. See https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html