SyntaxHighlighter

Tuesday, June 19, 2012

Spring Active Profiles - externalizing to properties files


a great solution over on stackoverflow works essentially like this;

- create your own implementation of an ApplicationContextInitializer
- read in an external reference (could even be a database, but properties file makes more sense)
- get the ConfigurableEnvironment from the passed context
- set the spring active profiles



to use this inside something like a WAR file, use the web.xml and set the file as an init param for the context.



http://stackoverflow.com/questions/8587489/how-to-set-active-spring-3-1-environment-profile-via-a-properites-file-and-not-v

No comments:

Post a Comment