當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。