To read a Spring profile I use :
<beans profile="LOC">
I have this property set as a jvm property :
-Dspring.profiles.active=LOC
Is it possible to use some logic just use the profile "LOC" if it exists and it does not exist use a default profile ?
This is possible in spring 3.2, where the ! operator has been introduced:
<beans profile="LOC">
<import resource="LOC.xml"/>
</beans>
<beans profile="!LOC">
<import resource="default.xml"/>
</beans>
LOC.xml will be included when the LOC profile is active. default.xml will be included if LOC is not defined.
The change has been announced here: http://www.springsource.org/node/3563
and the commit is here: https://github.com/SpringSource/spring-framework/commit/bcd44f3798ed06c0704d2a3564b8a9735e747e87
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With