But you can actually accomplish the same behaviour with little work as i will explain in this article. Let's take a look at my project structure:
I created a folder 'properties' in src/main/resources in which i included following property files:
- dev.properties
- test.properties
- prod.properties
- generic.properties --> shared properties for all environments
The only thing you need to do now is specify a systemvariable called 'environment.id'. In order to run my unit tests automically with maven i added this variable to surefure plugin in the pom.xml.
In my unit test i set the application-context.xml.
The unit test will not run however without the system variable so if you want to run the unit test from within Eclipse for example you need to specify this variable in the run configuration in the second tab 'Arguments' and more specific 'VM arguments'.
Here you can specify it as follows:
-Denvironment.id=dev