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.

software engineer and business advisor

He advocates for the maker-movement, self-directed learning and agile methods. His regular topics include: distributed systems, risk analysis and knowledge mana­ge­ment.

more information

published: 2011-03-02 updated: 2014-08-29