In my application I have beans annotated with @Profile(\"prod\")
and @Profile(\"demo\")
.
The first one, as you can guess :), is used on beans that
You can setup your web.xml as filtered resource and have this value filled by maven from maven profile settings - that what we do.
in pom filter all resources (you can do taht if you have no ${} marking in them)
<webResources>
<resource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
</resource>
</webResources>
in web.xml put
<context-param>
<param-name>spring.profiles.active</param-name>
<param-value>${spring.prfile}</param-value>
</context-param>
in pom create maven profiles
<profiles>
<profile>
<id>DEFAULT</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<spring.profile>prod</spring.profile>
</properties>
<profile>
<profile>
<id>DEMO</id>
<properties>
<spring.profile>demo</spring.profile>
</properties>
<profile>
</profiles>
Now you can use
mvn jetty:run -P DEMO
or simply -P DEMO
with any maven command