I have a spring web application which has several modules. Each module has its own spring context file. When i assemble the application these context files are built into jar files. Sometimes i need to change some configuration details in these files, for example data source database url. I don’t like when all configurations happen at compile time and require rebuilding. Is there a common way of configuring application at deploy time?
Thank you.
Depending of the application server you use, but a common way to configure database url is to use a property file on the server. The file is loaded when the server starts.
You can load this file using Spring with a PropertyPlaceholderConfigurer.
Then it’s possible to reference a property by its key.
What application server do you use?