Skip to main content

Posts

Showing posts from October, 2012

A solution to have environment specific Spring application context files

I found this post today : http://www.drillio.com/en/software-development/spring/context-bootstrapping-with-different-environment-configurations/

I have the following problem : I need to customize a web application. For example, on a production environment, I want my app to be automatically configured with production parameters. As this application uses Spring namespaces (grrrr), I can't use a DefaultPropertyPlaceHolderConfigurer to inject properties dynamically into config files. I really need to have Spring conf files per environment.

I made some changes to the code to make it compatible with Spring 2.5.6. Here are my classes :


https://sites.google.com/site/javacolorsfiles/SpringContextBootstrapper.java
https://sites.google.com/site/javacolorsfiles/ConfigLocationProviderImpl.java
https://sites.google.com/site/javacolorsfiles/ConfigLocationProvider.java

And an example of Spring conf behind :

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://w…