0
这里是我的情况:如何设置默认配置文件春天
a.xml
-----
<beans> <!-- no 'profile' attribute -->
<bean id="a" class="com.a.A"/>
</beans>
b.xml
-----
<beans > <!-- no 'profile' attribute -->
<bean id="b" class="com.b.B"/>
</beans>
c.xml
-----
<beans ><!-- no 'profile' attribute -->
<bean id="c" class="com.c.C"/>
</beans>
<beans profile="dev">
<rabbit:connection-factory id="connectionFactory"
host="x.x.net" username="a" port="xxxx"
password="a" />
....
....
</beans>
目的:
当我在本地运行我的应用程序,我想从A.XML加载所有豆类, b.xml和C.xml中的所有bean,除了配置文件“dev”
当我在开发环境中运行我的应用程序时,我想从a.xml,b.xml和C.xml中的所有bean中加载所有bean
我将-Dspring.profiles.active =!dev设置为JVM系统参数。问题是它没有加载其他bean。
任何想法,我该如何处理这种情况?
谢谢,@LetsBeFrank。 1.它将加载a,b,c.xml中的所有bean,除非在本地如果我没有传递任何配置文件,那么在本地标记为“dev”的那个bean除外。 2.它加载了a,b,c.xml中的所有bean,包括当我通过时标记为“dev”的bean:-Dspring.profiles.active = dev,default – Suman