Search in sources :

Example 11 with ConditionalOnClass

use of org.springframework.boot.autoconfigure.condition.ConditionalOnClass in project camel by apache.

the class ElasticsearchComponentAutoConfiguration method configureElasticsearchComponent.

@Lazy
@Bean(name = "elasticsearch5-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(ElasticsearchComponent.class)
public ElasticsearchComponent configureElasticsearchComponent(CamelContext camelContext) throws Exception {
    ElasticsearchComponent component = new ElasticsearchComponent();
    component.setCamelContext(camelContext);
    return component;
}
Also used : ElasticsearchComponent(org.apache.camel.component.elasticsearch5.ElasticsearchComponent) Lazy(org.springframework.context.annotation.Lazy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 12 with ConditionalOnClass

use of org.springframework.boot.autoconfigure.condition.ConditionalOnClass in project camel by apache.

the class EtcdComponentAutoConfiguration method configureEtcdComponent.

@Lazy
@Bean(name = "etcd-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(EtcdComponent.class)
public EtcdComponent configureEtcdComponent(CamelContext camelContext) throws Exception {
    EtcdComponent component = new EtcdComponent();
    component.setCamelContext(camelContext);
    return component;
}
Also used : EtcdComponent(org.apache.camel.component.etcd.EtcdComponent) Lazy(org.springframework.context.annotation.Lazy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 13 with ConditionalOnClass

use of org.springframework.boot.autoconfigure.condition.ConditionalOnClass in project camel by apache.

the class ExecComponentAutoConfiguration method configureExecComponent.

@Lazy
@Bean(name = "exec-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(ExecComponent.class)
public ExecComponent configureExecComponent(CamelContext camelContext) throws Exception {
    ExecComponent component = new ExecComponent();
    component.setCamelContext(camelContext);
    return component;
}
Also used : ExecComponent(org.apache.camel.component.exec.ExecComponent) Lazy(org.springframework.context.annotation.Lazy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 14 with ConditionalOnClass

use of org.springframework.boot.autoconfigure.condition.ConditionalOnClass in project camel by apache.

the class FlatpackComponentAutoConfiguration method configureFlatpackComponent.

@Lazy
@Bean(name = "flatpack-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(FlatpackComponent.class)
public FlatpackComponent configureFlatpackComponent(CamelContext camelContext) throws Exception {
    FlatpackComponent component = new FlatpackComponent();
    component.setCamelContext(camelContext);
    return component;
}
Also used : FlatpackComponent(org.apache.camel.component.flatpack.FlatpackComponent) Lazy(org.springframework.context.annotation.Lazy) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 15 with ConditionalOnClass

use of org.springframework.boot.autoconfigure.condition.ConditionalOnClass in project camel by apache.

the class FlatpackDataFormatAutoConfiguration method configureFlatpackDataFormatFactory.

@Bean(name = "flatpack-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(FlatpackDataFormat.class)
public DataFormatFactory configureFlatpackDataFormatFactory(final CamelContext camelContext, final FlatpackDataFormatConfiguration configuration) {
    return new DataFormatFactory() {

        public DataFormat newInstance() {
            FlatpackDataFormat dataformat = new FlatpackDataFormat();
            if (CamelContextAware.class.isAssignableFrom(FlatpackDataFormat.class)) {
                CamelContextAware contextAware = CamelContextAware.class.cast(dataformat);
                if (contextAware != null) {
                    contextAware.setCamelContext(camelContext);
                }
            }
            try {
                Map<String, Object> parameters = new HashMap<>();
                IntrospectionSupport.getProperties(configuration, parameters, null, false);
                IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), dataformat, parameters);
            } catch (Exception e) {
                throw new RuntimeCamelException(e);
            }
            return dataformat;
        }
    };
}
Also used : DataFormatFactory(org.apache.camel.spi.DataFormatFactory) CamelContextAware(org.apache.camel.CamelContextAware) HashMap(java.util.HashMap) RuntimeCamelException(org.apache.camel.RuntimeCamelException) FlatpackDataFormat(org.apache.camel.dataformat.flatpack.FlatpackDataFormat) RuntimeCamelException(org.apache.camel.RuntimeCamelException) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)295 Bean (org.springframework.context.annotation.Bean)295 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)294 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)289 Lazy (org.springframework.context.annotation.Lazy)223 HashMap (java.util.HashMap)183 Map (java.util.Map)106 CamelContextAware (org.apache.camel.CamelContextAware)69 RuntimeCamelException (org.apache.camel.RuntimeCamelException)45 DataFormatFactory (org.apache.camel.spi.DataFormatFactory)45 Scope (org.springframework.context.annotation.Scope)24 JavaScriptLanguage (org.apache.camel.builder.script.JavaScriptLanguage)1 PhpLanguage (org.apache.camel.builder.script.PhpLanguage)1 PythonLanguage (org.apache.camel.builder.script.PythonLanguage)1 RubyLanguage (org.apache.camel.builder.script.RubyLanguage)1 CoAPComponent (org.apache.camel.coap.CoAPComponent)1 AhcComponent (org.apache.camel.component.ahc.AhcComponent)1 WsComponent (org.apache.camel.component.ahc.ws.WsComponent)1 AMQPComponent (org.apache.camel.component.amqp.AMQPComponent)1 ApnsComponent (org.apache.camel.component.apns.ApnsComponent)1