在我的application-context.xml中,我正在使用
<import resource="classpath*:com/companyName/projectName/dao/dao-beans.xml"/>
在dao-beans.xml文件中,我正在使用
<beans profile="profile1;profile2;profile">
<import resource="classpath*:com/companyName/projectName/dao/spring/xyz/xyz-dao-beans.xml" />
</beans>
我对这部分是什么感到困惑-
<beans profile="profile1;profile2;profile">
这是否意味着对于要导入的xyz-dao-beans.xml中的所有bean,所有3个配置文件都应该处于活动状态,或者即使这3个中的任何一个都处于活动状态,xyz dao Bean也将被导入?
答案 0 :(得分:2)
您可以参考this documentation:
This is analogous to the behavior in Spring XML: if the profile attribute of the beans element is supplied e.g., <beans profile="p1,p2">, the beans element will not be parsed unless at least profile 'p1' or 'p2' has been activated. Likewise, if a @Component or @Configuration class is marked with @Profile({"p1", "p2"}), that class will not be registered or processed unless at least profile 'p1' or 'p2' has been activated.