Search in sources :

Example 46 with ConditionalOnMissingBean

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

the class CoAPComponentAutoConfiguration method configureCoAPComponent.

@Lazy
@Bean(name = "coap-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(CoAPComponent.class)
public CoAPComponent configureCoAPComponent(CamelContext camelContext) throws Exception {
    CoAPComponent component = new CoAPComponent();
    component.setCamelContext(camelContext);
    return component;
}
Also used : CoAPComponent(org.apache.camel.coap.CoAPComponent) 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 47 with ConditionalOnMissingBean

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

the class CometdComponentAutoConfiguration method configureCometdComponent.

@Lazy
@Bean(name = { "cometd-component", "cometds-component" })
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(CometdComponent.class)
public CometdComponent configureCometdComponent(CamelContext camelContext, CometdComponentConfiguration configuration) throws Exception {
    CometdComponent component = new CometdComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null, false);
    for (Map.Entry<String, Object> entry : parameters.entrySet()) {
        Object value = entry.getValue();
        Class<?> paramClass = value.getClass();
        if (paramClass.getName().endsWith("NestedConfiguration")) {
            Class nestedClass = null;
            try {
                nestedClass = (Class) paramClass.getDeclaredField("CAMEL_NESTED_CLASS").get(null);
                HashMap<String, Object> nestedParameters = new HashMap<>();
                IntrospectionSupport.getProperties(value, nestedParameters, null, false);
                Object nestedProperty = nestedClass.newInstance();
                IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), nestedProperty, nestedParameters);
                entry.setValue(nestedProperty);
            } catch (NoSuchFieldException e) {
            }
        }
    }
    IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters);
    return component;
}
Also used : CometdComponent(org.apache.camel.component.cometd.CometdComponent) HashMap(java.util.HashMap) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) HashMap(java.util.HashMap) Map(java.util.Map) 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 48 with ConditionalOnMissingBean

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

the class S3ComponentAutoConfiguration method configureS3Component.

@Lazy
@Bean(name = "aws-s3-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(S3Component.class)
public S3Component configureS3Component(CamelContext camelContext) throws Exception {
    S3Component component = new S3Component();
    component.setCamelContext(camelContext);
    return component;
}
Also used : S3Component(org.apache.camel.component.aws.s3.S3Component) 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 49 with ConditionalOnMissingBean

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

the class SesComponentAutoConfiguration method configureSesComponent.

@Lazy
@Bean(name = "aws-ses-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(SesComponent.class)
public SesComponent configureSesComponent(CamelContext camelContext) throws Exception {
    SesComponent component = new SesComponent();
    component.setCamelContext(camelContext);
    return component;
}
Also used : SesComponent(org.apache.camel.component.aws.ses.SesComponent) 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 50 with ConditionalOnMissingBean

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

the class SnsComponentAutoConfiguration method configureSnsComponent.

@Lazy
@Bean(name = "aws-sns-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(SnsComponent.class)
public SnsComponent configureSnsComponent(CamelContext camelContext) throws Exception {
    SnsComponent component = new SnsComponent();
    component.setCamelContext(camelContext);
    return component;
}
Also used : SnsComponent(org.apache.camel.component.aws.sns.SnsComponent) 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)

Aggregations

ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)807 Bean (org.springframework.context.annotation.Bean)807 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)339 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)298 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)251 Lazy (org.springframework.context.annotation.Lazy)227 lombok.val (lombok.val)210 HashMap (java.util.HashMap)190 Map (java.util.Map)113 CamelContextAware (org.apache.camel.CamelContextAware)69 RuntimeCamelException (org.apache.camel.RuntimeCamelException)45 DataFormatFactory (org.apache.camel.spi.DataFormatFactory)45 EnableConfigurationProperties (org.springframework.boot.context.properties.EnableConfigurationProperties)29 Scope (org.springframework.context.annotation.Scope)26 Autowired (org.springframework.beans.factory.annotation.Autowired)23 Configuration (org.springframework.context.annotation.Configuration)21 Qualifier (org.springframework.beans.factory.annotation.Qualifier)20 DefaultChainingMultifactorAuthenticationBypassProvider (org.apereo.cas.authentication.bypass.DefaultChainingMultifactorAuthenticationBypassProvider)19 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)19 AuthenticationMultifactorAuthenticationProviderBypassEvaluator (org.apereo.cas.authentication.bypass.AuthenticationMultifactorAuthenticationProviderBypassEvaluator)17