Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在XML中有条件地包含bean?_Java_Xml_Spring - Fatal编程技术网

Java 在XML中有条件地包含bean?

Java 在XML中有条件地包含bean?,java,xml,spring,Java,Xml,Spring,我的SpringXML中有以下bean定义 如果特定属性为true,我想有条件地包含它 If includeCustomBean==true <bean id="message" class="com.CustomReloadableResourceBundleMessageSource"> </bean> else <bean id="message"

我的SpringXML中有以下bean定义

如果特定属性为true,我想有条件地包含它

If includeCustomBean==true

   <bean id="message"
                     class="com.CustomReloadableResourceBundleMessageSource">
    </bean>

else

    <bean id="message"
                     class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    </bean>
如果includeCustomBean==true
其他的

有可能吗?

您可以像下面的示例一样使用Spring表达式语言

<bean class="com.example.MyBean">
 <property name="dependency" value="#{systemProperties['foo'] == 'bar' 
 ? dependencyX : dependencyY}" />
 </bean>

或者侧面图是另一个概念