I have an application with maven as a build tool.
I am using maven profiles to set up different properties from different profiles.
What i would like to do i
There is a more elegant way to switch between 2 maven+spring profiles simultaneously.
First, add profiles to POM (pay attention - maven+spring profile is activated by single system variable):
postgres
true
spring.profiles.active
postgres
postgresql
postgresql
9.1-901.jdbc4
h2
spring.profiles.active
h2
com.h2database
h2
1.4.191
Second, set default profile for spring (for maven it is already set in POM). For web application, I inserted following lines to web.xml:
spring.profiles.default
postgres
Third, add profile-dependent beans to your config. In my case (XML config), it is:
my.test.model
...
Now it is possible to:
mvn jetty:run or mvn jetty:run -Dspring.profiles.active=postgres commandsmvn clean jetty:run -Dspring.profiles.active=h2