当前位置: 首页>>代码示例>>Java>>正文


Java ConditionalOnClass类代码示例

本文整理汇总了Java中org.springframework.boot.autoconfigure.condition.ConditionalOnClass的典型用法代码示例。如果您正苦于以下问题:Java ConditionalOnClass类的具体用法?Java ConditionalOnClass怎么用?Java ConditionalOnClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConditionalOnClass类属于org.springframework.boot.autoconfigure.condition包,在下文中一共展示了ConditionalOnClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureJacksonDataFormat

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //导入依赖的package包/类
@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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:JacksonDataFormatAutoConfiguration.java

示例2: mqProducer

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //导入依赖的package包/类
@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;
}
 
开发者ID:QianmiOpen,项目名称:spring-boot-starter-rocketmq,代码行数:22,代码来源:RocketMQAutoConfiguration.java

示例3: metricsSchedulingAspect

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:10,代码来源:MetricsAutoConfiguration.java

示例4: configureRssDataFormat

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //导入依赖的package包/类
@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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:RssDataFormatAutoConfiguration.java

示例5: configureBeanIODataFormat

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //导入依赖的package包/类
@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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:BeanIODataFormatAutoConfiguration.java

示例6: if

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //导入依赖的package包/类
@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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:Base64DataFormatAutoConfiguration.java

示例7: configureZipFileDataFormat

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //导入依赖的package包/类
@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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:ZipFileDataFormatAutoConfiguration.java

示例8: configureMimeMultipartDataFormat

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //导入依赖的package包/类
@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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:MimeMultipartDataFormatAutoConfiguration.java

示例9: configureStringDataFormat

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //导入依赖的package包/类
@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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:StringDataFormatAutoConfiguration.java

示例10: configureZipDataFormat

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //导入依赖的package包/类
@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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:ZipDataFormatAutoConfiguration.java

示例11: configureFlatpackDataFormat

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //导入依赖的package包/类
@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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:FlatpackDataFormatAutoConfiguration.java

示例12: configureDigitalSignatureComponent

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //导入依赖的package包/类
@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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:DigitalSignatureComponentAutoConfiguration.java

示例13: configureXMLSecurityDataFormat

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //导入依赖的package包/类
@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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:XMLSecurityDataFormatAutoConfiguration.java

示例14: configureUniVocityTsvDataFormat

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //导入依赖的package包/类
@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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:UniVocityTsvDataFormatAutoConfiguration.java

示例15: configureUniVocityCsvDataFormat

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; //导入依赖的package包/类
@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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:UniVocityCsvDataFormatAutoConfiguration.java


注:本文中的org.springframework.boot.autoconfigure.condition.ConditionalOnClass类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。