我开始使用bean配置文件来创建条件bean,但当我使用ref
配置文件之外的配置文件bean时,我得到异常nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'pb' is defined
<bean id="q" class="com.Q"> //spring can not create this bean since it depends on `pb` bean which is profiled.
<property name="p" ref="pb"/>
</bean>
<beans profile="a">
<bean id="pb" class="com.T"/>
</beans>
<beans profile="b">
<bean id="pb" class="com.T"/>
</beans>
我怎样才能做到这一点?我确信a
个人资料已开启:
System.setProperty(AbstractEnvironment.DEFAULT_PROFILES_PROPERTY_NAME, "a");
System.setProperty(AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME, "a");