How to "disable" a bean reference in camel blueprint?

480 views Asked by At

I'm using camel. This is (an extract of) my blueprint:

<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>

I want "disable" the bean "sap-configuration" but without using XML comments. Something like this:

<bean id="sap-configuration" enabled=${ENABLED} class="org.fusesource.camel.component.sap.SapConnectionConfiguration">
    .
    .
</bean>

I can define the camel routes I want to activate using "autoStartup" and property placeholders "autoStartup=${ENABLED}" but I can't find how to do this with the bean.

1

There are 1 answers

0
Claus Ibsen On BEST ANSWER

This is not possible. Its how OSGi blueprint works. If you define a <bean> then its in use.