本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}