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