Java Code Examples for org.springframework.boot.autoconfigure.condition.ConditionalOnClass

The following are top voted examples for showing how to use org.springframework.boot.autoconfigure.condition.ConditionalOnClass. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: spring-boot-starter-rocketmq   File: RocketMQAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(DefaultMQProducer.class)
@ConditionalOnMissingBean(DefaultMQProducer.class)
@ConditionalOnProperty(prefix = "spring.rocketmq", value = {"nameServer", "producer.group"})
public DefaultMQProducer mqProducer(RocketMQProperties rocketMQProperties) {

    RocketMQProperties.Producer producerConfig = rocketMQProperties.getProducer();
    String groupName = producerConfig.getGroup();
    Assert.hasText(groupName, "[spring.rocketmq.producer.group] must not be null");

    DefaultMQProducer producer = new DefaultMQProducer(producerConfig.getGroup());
    producer.setNamesrvAddr(rocketMQProperties.getNameServer());
    producer.setSendMsgTimeout(producerConfig.getSendMsgTimeout());
    producer.setRetryTimesWhenSendFailed(producerConfig.getRetryTimesWhenSendFailed());
    producer.setRetryTimesWhenSendAsyncFailed(producerConfig.getRetryTimesWhenSendAsyncFailed());
    producer.setMaxMessageSize(producerConfig.getMaxMessageSize());
    producer.setCompressMsgBodyOverHowmuch(producerConfig.getCompressMsgBodyOverHowmuch());
    producer.setRetryAnotherBrokerWhenNotStoreOK(producerConfig.isRetryAnotherBrokerWhenNotStoreOk());

    return producer;
}
 
Example 2
Project: micrometer   File: MetricsAutoConfiguration.java   View source code 6 votes vote down vote up
/**
 * If AOP is not enabled, scheduled interception will not work.
 */
@Bean
@ConditionalOnClass(name = "org.aspectj.lang.ProceedingJoinPoint")
@ConditionalOnProperty(value = "spring.aop.enabled", havingValue = "true", matchIfMissing = true)
public ScheduledMethodMetrics metricsSchedulingAspect(MeterRegistry registry) {
    return new ScheduledMethodMetrics(registry);
}
 
Example 3
Project: Camel   File: RssDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(RssDataFormat.class)
public RssDataFormat configureRssDataFormat(CamelContext camelContext,
        RssDataFormatConfiguration configuration) throws Exception {
    RssDataFormat dataformat = new RssDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 4
Project: Camel   File: BeanIODataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BeanIODataFormat.class)
public BeanIODataFormat configureBeanIODataFormat(
        CamelContext camelContext,
        BeanIODataFormatConfiguration configuration) throws Exception {
    BeanIODataFormat dataformat = new BeanIODataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 5
Project: Camel   File: Base64DataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(Base64DataFormat.class)
public Base64DataFormat configureBase64DataFormat(
        CamelContext camelContext,
        Base64DataFormatConfiguration configuration) throws Exception {
    Base64DataFormat dataformat = new Base64DataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 6
Project: Camel   File: ZipFileDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(ZipFileDataFormat.class)
public ZipFileDataFormat configureZipFileDataFormat(
        CamelContext camelContext,
        ZipFileDataFormatConfiguration configuration) throws Exception {
    ZipFileDataFormat dataformat = new ZipFileDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 7
Project: Camel   File: MimeMultipartDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(MimeMultipartDataFormat.class)
public MimeMultipartDataFormat configureMimeMultipartDataFormat(
        CamelContext camelContext,
        MimeMultipartDataFormatConfiguration configuration)
        throws Exception {
    MimeMultipartDataFormat dataformat = new MimeMultipartDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 8
Project: Camel   File: StringDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(StringDataFormat.class)
public StringDataFormat configureStringDataFormat(
        CamelContext camelContext,
        StringDataFormatConfiguration configuration) throws Exception {
    StringDataFormat dataformat = new StringDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 9
Project: Camel   File: ZipDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(ZipDataFormat.class)
public ZipDataFormat configureZipDataFormat(CamelContext camelContext,
        ZipDataFormatConfiguration configuration) throws Exception {
    ZipDataFormat dataformat = new ZipDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 10
Project: Camel   File: FlatpackDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(FlatpackDataFormat.class)
public FlatpackDataFormat configureFlatpackDataFormat(
        CamelContext camelContext,
        FlatpackDataFormatConfiguration configuration) throws Exception {
    FlatpackDataFormat dataformat = new FlatpackDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 11
Project: Camel   File: DigitalSignatureComponentAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(DigitalSignatureComponent.class)
public DigitalSignatureComponent configureDigitalSignatureComponent(
        CamelContext camelContext,
        DigitalSignatureComponentConfiguration configuration)
        throws Exception {
    DigitalSignatureComponent component = new DigitalSignatureComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), component, parameters);
    return component;
}
 
Example 12
Project: Camel   File: XMLSecurityDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(XMLSecurityDataFormat.class)
public XMLSecurityDataFormat configureXMLSecurityDataFormat(
        CamelContext camelContext,
        XMLSecurityDataFormatConfiguration configuration) throws Exception {
    XMLSecurityDataFormat dataformat = new XMLSecurityDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 13
Project: Camel   File: UniVocityTsvDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(UniVocityTsvDataFormat.class)
public UniVocityTsvDataFormat configureUniVocityTsvDataFormat(
        CamelContext camelContext,
        UniVocityTsvDataFormatConfiguration configuration) throws Exception {
    UniVocityTsvDataFormat dataformat = new UniVocityTsvDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 14
Project: Camel   File: UniVocityCsvDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(UniVocityCsvDataFormat.class)
public UniVocityCsvDataFormat configureUniVocityCsvDataFormat(
        CamelContext camelContext,
        UniVocityCsvDataFormatConfiguration configuration) throws Exception {
    UniVocityCsvDataFormat dataformat = new UniVocityCsvDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 15
Project: Camel   File: XmlJsonDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(XmlJsonDataFormat.class)
public XmlJsonDataFormat configureXmlJsonDataFormat(
        CamelContext camelContext,
        XmlJsonDataFormatConfiguration configuration) throws Exception {
    XmlJsonDataFormat dataformat = new XmlJsonDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 16
Project: Camel   File: BoonDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BoonDataFormat.class)
public BoonDataFormat configureBoonDataFormat(CamelContext camelContext,
        BoonDataFormatConfiguration configuration) throws Exception {
    BoonDataFormat dataformat = new BoonDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 17
Project: Camel   File: SyslogDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(SyslogDataFormat.class)
public SyslogDataFormat configureSyslogDataFormat(
        CamelContext camelContext,
        SyslogDataFormatConfiguration configuration) throws Exception {
    SyslogDataFormat dataformat = new SyslogDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 18
Project: Camel   File: JacksonDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JacksonDataFormat.class)
public JacksonDataFormat configureJacksonDataFormat(
        CamelContext camelContext,
        JacksonDataFormatConfiguration configuration) throws Exception {
    JacksonDataFormat dataformat = new JacksonDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 19
Project: Camel   File: HessianDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(HessianDataFormat.class)
public HessianDataFormat configureHessianDataFormat(
        CamelContext camelContext,
        HessianDataFormatConfiguration configuration) throws Exception {
    HessianDataFormat dataformat = new HessianDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 20
Project: Camel   File: AvroDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(AvroDataFormat.class)
public AvroDataFormat configureAvroDataFormat(CamelContext camelContext,
        AvroDataFormatConfiguration configuration) throws Exception {
    AvroDataFormat dataformat = new AvroDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 21
Project: Camel   File: BindyKeyValuePairDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BindyKeyValuePairDataFormat.class)
public BindyKeyValuePairDataFormat configureBindyKeyValuePairDataFormat(
        CamelContext camelContext,
        BindyKeyValuePairDataFormatConfiguration configuration)
        throws Exception {
    BindyKeyValuePairDataFormat dataformat = new BindyKeyValuePairDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 22
Project: Camel   File: JibxDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JibxDataFormat.class)
public JibxDataFormat configureJibxDataFormat(CamelContext camelContext,
        JibxDataFormatConfiguration configuration) throws Exception {
    JibxDataFormat dataformat = new JibxDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 23
Project: Camel   File: CryptoDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(CryptoDataFormat.class)
public CryptoDataFormat configureCryptoDataFormat(
        CamelContext camelContext,
        CryptoDataFormatConfiguration configuration) throws Exception {
    CryptoDataFormat dataformat = new CryptoDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 24
Project: Camel   File: GoogleCalendarComponentAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(GoogleCalendarComponent.class)
public GoogleCalendarComponent configureGoogleCalendarComponent(
        CamelContext camelContext,
        GoogleCalendarComponentConfiguration configuration)
        throws Exception {
    GoogleCalendarComponent component = new GoogleCalendarComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), component, parameters);
    return component;
}
 
Example 25
Project: Camel   File: BindyFixedLengthDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BindyFixedLengthDataFormat.class)
public BindyFixedLengthDataFormat configureBindyFixedLengthDataFormat(
        CamelContext camelContext,
        BindyFixedLengthDataFormatConfiguration configuration)
        throws Exception {
    BindyFixedLengthDataFormat dataformat = new BindyFixedLengthDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 26
Project: Camel   File: TidyMarkupDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(TidyMarkupDataFormat.class)
public TidyMarkupDataFormat configureTidyMarkupDataFormat(
        CamelContext camelContext,
        TidyMarkupDataFormatConfiguration configuration) throws Exception {
    TidyMarkupDataFormat dataformat = new TidyMarkupDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 27
Project: Camel   File: SnakeYAMLDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(SnakeYAMLDataFormat.class)
public SnakeYAMLDataFormat configureSnakeYAMLDataFormat(
        CamelContext camelContext,
        SnakeYAMLDataFormatConfiguration configuration) throws Exception {
    SnakeYAMLDataFormat dataformat = new SnakeYAMLDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 28
Project: Camel   File: JacksonXMLDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JacksonXMLDataFormat.class)
public JacksonXMLDataFormat configureJacksonXMLDataFormat(
        CamelContext camelContext,
        JacksonXMLDataFormatConfiguration configuration) throws Exception {
    JacksonXMLDataFormat dataformat = new JacksonXMLDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 29
Project: Camel   File: CastorDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(CastorDataFormat.class)
public CastorDataFormat configureCastorDataFormat(
        CamelContext camelContext,
        CastorDataFormatConfiguration configuration) throws Exception {
    CastorDataFormat dataformat = new CastorDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 30
Project: Camel   File: XmlRpcDataFormatAutoConfiguration.java   View source code 6 votes vote down vote up
@Bean
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(XmlRpcDataFormat.class)
public XmlRpcDataFormat configureXmlRpcDataFormat(
        CamelContext camelContext,
        XmlRpcDataFormatConfiguration configuration) throws Exception {
    XmlRpcDataFormat dataformat = new XmlRpcDataFormat();
    if (dataformat instanceof CamelContextAware) {
        ((CamelContextAware) dataformat).setCamelContext(camelContext);
    }
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    IntrospectionSupport.setProperties(camelContext,
            camelContext.getTypeConverter(), dataformat, parameters);
    return dataformat;
}
 
Example 31
Project: cas-5.1.0   File: CasEmbeddedContainerTomcatConfiguration.java   View source code 5 votes vote down vote up
@ConditionalOnClass(value = {Tomcat.class, Http2Protocol.class})
@Bean
public EmbeddedServletContainerFactory servletContainer() {
    final TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();

    configureAjp(tomcat);
    configureHttp(tomcat);
    configureHttpProxy(tomcat);
    configureExtendedAccessLogValve(tomcat);
    configureRewriteValve(tomcat);
    configureSSLValve(tomcat);

    return tomcat;
}
 
Example 32
Project: spring-cloud-ribbon-extensions   File: HttpLoggingConfig.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnClass(Logger.class)
public CommonsRequestLoggingFilter springLogging() {
    Logger logger = (Logger) LoggerFactory.getLogger(CommonsRequestLoggingFilter.class);
    logger.setLevel(Level.DEBUG);
    log.info("Http logging enabled {}.", properties);
    return requestLoggingFilter();
}
 
Example 33
Project: micrometer   File: MeterBindersConfiguration.java   View source code 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean(LogbackMetrics.class)
@ConditionalOnProperty(value = "management.metrics.binders.logback.enabled", matchIfMissing = true)
@ConditionalOnClass(name = "ch.qos.logback.classic.Logger")
public LogbackMetrics logbackMetrics() {
    return new LogbackMetrics();
}
 
Example 34
Project: syndesis   File: TradeInsightTopConnectorAutoConfiguration.java   View source code 5 votes vote down vote up
@Lazy
@Bean(name = "trade-insight-top-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public TradeInsightTopComponent configureTradeInsightTopComponent()
        throws Exception {
    TradeInsightTopComponent connector = new TradeInsightTopComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<TradeInsightTopComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.trade-insight-top.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.trade-insight-top.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
 
Example 35
Project: syndesis   File: TradeInsightSellConnectorAutoConfiguration.java   View source code 5 votes vote down vote up
@Lazy
@Bean(name = "trade-insight-sell-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public TradeInsightSellComponent configureTradeInsightSellComponent()
        throws Exception {
    TradeInsightSellComponent connector = new TradeInsightSellComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<TradeInsightSellComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.trade-insight-sell.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.trade-insight-sell.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
 
Example 36
Project: syndesis   File: TradeInsightBuyConnectorAutoConfiguration.java   View source code 5 votes vote down vote up
@Lazy
@Bean(name = "trade-insight-buy-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public TradeInsightBuyComponent configureTradeInsightBuyComponent()
        throws Exception {
    TradeInsightBuyComponent connector = new TradeInsightBuyComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<TradeInsightBuyComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.trade-insight-buy.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.trade-insight-buy.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
 
Example 37
Project: syndesis   File: DayTradePlaceConnectorAutoConfiguration.java   View source code 5 votes vote down vote up
@Lazy
@Bean(name = "day-trade-place-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public DayTradePlaceComponent configureDayTradePlaceComponent()
        throws Exception {
    DayTradePlaceComponent connector = new DayTradePlaceComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<DayTradePlaceComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.day-trade-place.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.day-trade-place.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
 
Example 38
Project: syndesis   File: DayTradeGetConnectorAutoConfiguration.java   View source code 5 votes vote down vote up
@Lazy
@Bean(name = "day-trade-get-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public DayTradeGetComponent configureDayTradeGetComponent()
        throws Exception {
    DayTradeGetComponent connector = new DayTradeGetComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<DayTradeGetComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.day-trade-get.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.connector.customizer",
                            "camel.connector.day-trade-get.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
 
Example 39
Project: syndesis   File: HttpGetConnectorAutoConfiguration.java   View source code 5 votes vote down vote up
@Lazy
@Bean(name = "http-get-connector-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public HttpGetComponent configureHttpGetComponent() throws Exception {
    HttpGetComponent connector = new HttpGetComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<HttpGetComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.http-get-connector.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.http-get-connector.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}
 
Example 40
Project: syndesis   File: HttpPostConnectorAutoConfiguration.java   View source code 5 votes vote down vote up
@Lazy
@Bean(name = "http-post-connector-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public HttpPostComponent configureHttpPostComponent() throws Exception {
    HttpPostComponent connector = new HttpPostComponent();
    connector.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, connector,
            parameters, false);
    connector.setOptions(parameters);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ConnectorCustomizer<HttpPostComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator
                            .evaluate(
                                    applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.http-post-connector.customizer",
                                    ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator
                            .evaluate(applicationContext.getEnvironment(),
                                    "camel.connector.customizer",
                                    "camel.connector.http-post-connector.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure connector {}, with customizer {}",
                        connector, customizer);
                customizer.customize(connector);
            }
        }
    }
    return connector;
}