我正在使用 Camel 。这是我的蓝图(摘录):
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<cm:property-placeholder id="placeholder" persistent-id="com.adelco.articulos" />
<!-- Configures the Inbound and Outbound SAP Connections -->
<bean id="sap-configuration" class="org.fusesource.camel.component.sap.SapConnectionConfiguration">
.
.
</bean>
<!--A lot of things here, let's omit them-->
<!-- Route beans-->
<bean id="rutaSTEPEntrada" class="com.adelco.articulos.RutaSTEPEntrada"/>
<bean id="rutaSTEPSap" class="com.adelco.articulos.RutaSTEPSap"/>
<camelContext id="camel-articulos" xmlns="http://camel.apache.org/schema/blueprint">
<routeBuilder ref="rutaSTEPEntrada"/>
<routeBuilder ref="rutaSTEPSap"/>
</camelContext>
</blueprint>
我想“禁用”bean“sap-configuration”,但不使用 XML 注释。像这样的事情:
<bean id="sap-configuration" enabled=${ENABLED} class="org.fusesource.camel.component.sap.SapConnectionConfiguration">
.
.
</bean>
我可以使用“autoStartup”和属性占位符“autoStartup=${ENABLED}”定义要激活的 Camel 路线,但我找不到如何使用 bean 执行此操作。
最佳答案
这是不可能的。这就是 OSGi 蓝图的工作原理。如果您定义 <bean>
然后就可以使用了。
关于java - 如何在camel蓝图中引用 "disable"bean?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41265847/