I've come across 2 ways to Externalize configuration properties and it really depends on the technologies you have at your disposal.
- Using Spring's PropertyPlaceholderConfigurer: More details
- Using Maven's Resource filtering: More details
Preferrably, I like to use the Maven Resource filtering strategy, because it allows you to easily create a different build depending on the type of deployment you'd like to use based on Maven Profiles. Here's a good quote describing Maven resource filtering:
You can use Maven to perform variable replacement on project resources. When resource filtering is activated, Maven will scan resources for references to Maven property references surrounded by
}. When it finds these references it will replace them with the appropriate value in much the same way the properties defined in the previous section can be referenced from a POM. This feature is especially helpful when you need to parameterize a build with different configuration values depending on the target deployment platform.