Spring Framework property management

March 2, 2011
1 min

The original article here described a complex way to enable this feature in earlier Spring Framework versions. Since Spring 3.1, there is a unified property management that does exactly that, and I’ve removed the original content for clarity.

I think the most usefule part of the property management is the following configuration setting:

<beans>
    <import resource="some/enterprise/service/${environment}-config.xml"/>
</beans>

It enables us to define environments separately, like:

  • test-config.xml
  • integration-config.xml
  • production-config.xml

And for each of these environments, you may use your specific implementation, settings and wiring.

It important to note that in the latest versions of Spring, you can achieve similar effect with class- and annotation-based configuration.

Last updated: August 29, 2014
Question? Comment?
Contact us!