类org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean源码实例Demo

下面列出了怎么用org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean的API类实例代码及写法,或者点击链接到github查看源代码。

@Bean
@ConditionalOnMissingBean
public ClientBuilderConfiguration clientConfiguration(OSSProperties ossProperties) {
	Properties properties = asProperties(ossProperties.getProperties());
	ClientBuilderConfiguration configuration = new ClientBuilderConfiguration();
	configuration.setMaxConnections(Integer.parseInt(properties.getProperty("aliyun.maxConnections", "5")));
	configuration.setSocketTimeout(Integer.parseInt(properties.getProperty("aliyun.socketTimeout", "50000")));
	configuration
			.setConnectionTimeout(Integer.parseInt(properties.getProperty("aliyun.connectionTimeout", "50000")));
	configuration.setConnectionRequestTimeout(
			Integer.parseInt(properties.getProperty("aliyun.connectionRequestTimeout", "-1")));
	configuration
			.setIdleConnectionTime(Integer.parseInt(properties.getProperty("aliyun.idleConnectionTime", "60000")));
	configuration.setMaxErrorRetry(Integer.parseInt(properties.getProperty("aliyun.maxErrorRetry", "3")));
	configuration.setSupportCname(Boolean.parseBoolean(properties.getProperty("aliyun.supportCname", "false")));
	configuration.setSLDEnabled(Boolean.parseBoolean(properties.getProperty("aliyun.sldEnabled", "false")));
	configuration.setProtocol(Protocol.HTTP);
	if (Protocol.HTTPS.toString().equals(properties.getProperty("aliyun.protocol"))) {
		configuration.setProtocol(Protocol.HTTPS);
	}
	if (properties.getProperty("aliyun.userAgent") != null) {
		configuration.setUserAgent(properties.getProperty("aliyun.userAgent"));
	}

	return configuration;
}
 
源代码2 项目: xmall   文件: JacksonConfig.java
@Bean
    @Primary
    @ConditionalOnMissingBean(ObjectMapper.class)
    public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {
        ObjectMapper objectMapper = builder.createXmlMapper(false).build();

        // 通过该方法对mapper对象进行设置,所有序列化的对象都将按改规则进行系列化
        // Include.Include.ALWAYS 默认
        // Include.NON_DEFAULT 属性为默认值不序列化
        // Include.NON_EMPTY 属性为 空("") 或者为 NULL 都不序列化,则返回的json是没有这个字段的。这样对移动端会更省流量
        // Include.NON_NULL 属性为NULL 不序列化,就是为null的字段不参加序列化
        objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);

        // 字段保留,将null值转为""
//        objectMapper.getSerializerProvider().setNullValueSerializer(new JsonSerializer<Object>()
//        {
//            @Override
//            public void serialize(Object o, JsonGenerator jsonGenerator,
//                                  SerializerProvider serializerProvider)
//                    throws IOException, JsonProcessingException
//            {
//                jsonGenerator.writeString("");
//            }
//        });
        return objectMapper;
    }
 
@Bean
@ConditionalOnMissingBean
public IFrostmourneSpiApi frostmourneSpiApi() {

    if(frostmourneSpiProperties.getMock()) {
        return new MockFrostmourneSpi();
    }

    return Feign.builder().options(defaultOptions())
            .encoder(new JacksonEncoder())
            .decoder(new JacksonDecoder())
            .retryer(feignRetryer())
            .client(okHttpClient)
            .logLevel(feignLoggerLevel())
            .target(IFrostmourneSpiApi.class, frostmourneSpiProperties.getServiceAddr());
}
 
源代码4 项目: staffjoy   文件: FaradayConfiguration.java
@Bean
@ConditionalOnMissingBean
public MappingsProvider faradayConfigurationMappingsProvider(EnvConfig envConfig,
                                                MappingsValidator mappingsValidator,
                                                HttpClientProvider httpClientProvider) {
    if (faradayProperties.isEnableProgrammaticMapping()) {
        return new ProgrammaticMappingsProvider(
                envConfig, serverProperties,
                faradayProperties, mappingsValidator,
                httpClientProvider);
    } else {
        return new ConfigurationMappingsProvider(
                serverProperties,
                faradayProperties, mappingsValidator,
                httpClientProvider);
    }
}
 
源代码5 项目: magic-starter   文件: MinIoAutoConfiguration.java
@Bean
@SneakyThrows
@ConditionalOnMissingBean
public MinioClient minioClient() {
	return new MinioClient(ossProperties.getMinIo()
		.getEndpoint(), ossProperties.getMinIo()
		.getAccessKey(), ossProperties.getMinIo()
		.getSecretKey());
}
 
@Lazy
@Bean(name = "dropbox-component")
@ConditionalOnMissingBean(DropboxComponent.class)
public DropboxComponent configureDropboxComponent() throws Exception {
    DropboxComponent component = new DropboxComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<DropboxComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.dropbox.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.dropbox.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
@Lazy
@Bean(name = "servlet-component")
@ConditionalOnMissingBean(ServletComponent.class)
public ServletComponent configureServletComponent() throws Exception {
    ServletComponent component = new ServletComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<ServletComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.servlet.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.servlet.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
源代码8 项目: fw-spring-cloud   文件: DroolsConfig.java
@Bean
@ConditionalOnMissingBean
public KieContainer kieContainer() throws IOException {
    KieRepository kieRepository = kieServices.getRepository();
    kieRepository.addKieModule(kieRepository::getDefaultReleaseId);
    KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem());
    kieBuilder.buildAll();
    return kieServices.newKieContainer(kieRepository.getDefaultReleaseId());
}
 
@Lazy
@Bean(name = "aws-kms-component")
@ConditionalOnMissingBean(KMSComponent.class)
public KMSComponent configureKMSComponent() throws Exception {
    KMSComponent component = new KMSComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<KMSComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.aws-kms.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.aws-kms.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
@Bean
@ConditionalOnMissingBean
public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) {
    ExecutorType executorType = this.properties.getExecutorType();
    if (executorType != null) {
        return new SqlSessionTemplate(sqlSessionFactory, executorType);
    } else {
        return new SqlSessionTemplate(sqlSessionFactory);
    }
}
 
@Bean
/**
 * Description: 当容器中没有指定Bean的情况下,自动配置MyStarterService类
 */
@ConditionalOnMissingBean(MyStarter.class)
public MyStarter MyStarterService(){
    MyStarter myStarterService = new MyStarter(myproperties);
    return myStarterService;
}
 
@Bean
@RxMVC
@ConditionalOnMissingBean
@ConditionalOnClass(Observable.class)
public ObservableReturnValueHandler observableReturnValueHandler() {
    return new ObservableReturnValueHandler();
}
 
@Lazy
@Bean(name = "spring-ldap-component")
@ConditionalOnMissingBean(SpringLdapComponent.class)
public SpringLdapComponent configureSpringLdapComponent() throws Exception {
    SpringLdapComponent component = new SpringLdapComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<SpringLdapComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.spring-ldap.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.spring-ldap.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
@Lazy
@Bean(name = "ahc-component")
@ConditionalOnMissingBean(AhcComponent.class)
public AhcComponent configureAhcComponent() throws Exception {
    AhcComponent component = new AhcComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<AhcComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.ahc.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.ahc.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
源代码15 项目: codeway_service   文件: JsonRedisSerializable.java
/**
*  配置Redis
* @param redisConnectionFactory redis连接工厂
*/
  @Bean
  @ConditionalOnMissingBean(name = "redisTemplate")
  public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
      RedisTemplate<Object, Object> template = new RedisTemplate<>();
      template.setConnectionFactory(redisConnectionFactory);
      template.setDefaultSerializer(new Jackson2JsonRedisSerializer<>(Object.class));
      return template;
  }
 
@Bean
@ConditionalOnMissingBean
public SchedulerFactoryBean quartzScheduler() {
    SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
    SpringBeanJobFactory jobFactory = new SpringBeanJobFactory();
    jobFactory.setApplicationContext(this.applicationContext);
    schedulerFactoryBean.setJobFactory(jobFactory);
    if (this.properties.getSchedulerName() != null) {
        schedulerFactoryBean.setSchedulerName(this.properties.getSchedulerName());
    }

    schedulerFactoryBean.setAutoStartup(this.properties.isAutoStartup());
    schedulerFactoryBean.setStartupDelay((int) this.properties.getStartupDelay().getSeconds());
    schedulerFactoryBean.setWaitForJobsToCompleteOnShutdown(this.properties.isWaitForJobsToCompleteOnShutdown());
    schedulerFactoryBean.setOverwriteExistingJobs(this.properties.isOverwriteExistingJobs());
    if (!this.properties.getProperties().isEmpty()) {
        schedulerFactoryBean.setQuartzProperties(this.asProperties(this.properties.getProperties()));
    }

    if (this.jobDetails != null && this.jobDetails.length > 0) {
        schedulerFactoryBean.setJobDetails(this.jobDetails);
    }

    if (this.calendars != null && !this.calendars.isEmpty()) {
        schedulerFactoryBean.setCalendars(this.calendars);
    }

    if (this.triggers != null && this.triggers.length > 0) {
        schedulerFactoryBean.setTriggers(this.triggers);
    }

    this.customize(schedulerFactoryBean);
    return schedulerFactoryBean;
}
 
@Lazy
@Bean(name = "crypto-cms-component")
@ConditionalOnMissingBean(CryptoCmsComponent.class)
public CryptoCmsComponent configureCryptoCmsComponent() throws Exception {
    CryptoCmsComponent component = new CryptoCmsComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<CryptoCmsComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.crypto-cms.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.crypto-cms.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
@Lazy
@Bean(name = "aws-sns-component")
@ConditionalOnMissingBean(SnsComponent.class)
public SnsComponent configureSnsComponent() throws Exception {
    SnsComponent component = new SnsComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<SnsComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.aws-sns.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.aws-sns.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
@Lazy
@Bean(name = "disruptor-vm-component")
@ConditionalOnMissingBean(DisruptorVmComponent.class)
public DisruptorVmComponent configureDisruptorVmComponent() throws Exception {
    DisruptorVmComponent component = new DisruptorVmComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<DisruptorVmComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.disruptor-vm.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.disruptor-vm.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
@Lazy
@Bean(name = "ipfs-component")
@ConditionalOnMissingBean(IPFSComponent.class)
public IPFSComponent configureIPFSComponent() throws Exception {
    IPFSComponent component = new IPFSComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<IPFSComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.ipfs.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.ipfs.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
@Lazy
@Bean(name = "openshift-builds-component")
@ConditionalOnMissingBean(OpenshiftBuildsComponent.class)
public OpenshiftBuildsComponent configureOpenshiftBuildsComponent()
        throws Exception {
    OpenshiftBuildsComponent component = new OpenshiftBuildsComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<OpenshiftBuildsComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.openshift-builds.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.openshift-builds.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
源代码22 项目: springdoc-openapi   文件: SpringDocConfiguration.java
/**
 * Polymorphic model converter polymorphic model converter.
 *
 * @return the polymorphic model converter
 */
@Bean
@ConditionalOnMissingBean
@Lazy(false)
PolymorphicModelConverter polymorphicModelConverter() {
	return new PolymorphicModelConverter();
}
 
源代码23 项目: sqlhelper   文件: JdbcTemplateAutoConfiguration.java
@Bean
@Primary
@ConditionalOnSingleCandidate(JdbcTemplate.class)
@ConditionalOnMissingBean(NamedParameterJdbcOperations.class)
public NamedParameterJdbcTemplate namedParameterJdbcTemplate(JdbcTemplate jdbcTemplate) {
    return new NamedParameterJdbcTemplate(jdbcTemplate);
}
 
@Lazy
@Bean(name = "servicenow-component")
@ConditionalOnMissingBean(ServiceNowComponent.class)
public ServiceNowComponent configureServiceNowComponent() throws Exception {
    ServiceNowComponent component = new ServiceNowComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<ServiceNowComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.servicenow.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.servicenow.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
@Lazy
@Bean(name = "dataset-test-component")
@ConditionalOnMissingBean(DataSetTestComponent.class)
public DataSetTestComponent configureDataSetTestComponent() throws Exception {
    DataSetTestComponent component = new DataSetTestComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<DataSetTestComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.dataset-test.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.dataset-test.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
@Lazy
@Bean(name = "dataset-component")
@ConditionalOnMissingBean(DataSetComponent.class)
public DataSetComponent configureDataSetComponent() throws Exception {
    DataSetComponent component = new DataSetComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<DataSetComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.dataset.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.dataset.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
@Lazy
@Bean(name = "google-sheets-component")
@ConditionalOnMissingBean(GoogleSheetsComponent.class)
public GoogleSheetsComponent configureGoogleSheetsComponent()
        throws Exception {
    GoogleSheetsComponent component = new GoogleSheetsComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<GoogleSheetsComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.google-sheets.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.google-sheets.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
@Lazy
@Bean(name = "vm-component")
@ConditionalOnMissingBean(VmComponent.class)
public VmComponent configureVmComponent() throws Exception {
    VmComponent component = new VmComponent();
    component.setCamelContext(camelContext);
    Map<String, Object> parameters = new HashMap<>();
    IntrospectionSupport.getProperties(configuration, parameters, null,
            false);
    CamelPropertiesHelper.setCamelProperties(camelContext, component,
            parameters, false);
    if (ObjectHelper.isNotEmpty(customizers)) {
        for (ComponentCustomizer<VmComponent> customizer : customizers) {
            boolean useCustomizer = (customizer instanceof HasId)
                    ? HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.vm.customizer",
                            ((HasId) customizer).getId())
                    : HierarchicalPropertiesEvaluator.evaluate(
                            applicationContext.getEnvironment(),
                            "camel.component.customizer",
                            "camel.component.vm.customizer");
            if (useCustomizer) {
                LOGGER.debug("Configure component {}, with customizer {}",
                        component, customizer);
                customizer.customize(component);
            }
        }
    }
    return component;
}
 
源代码29 项目: chronus   文件: DubboConfiguration.java
@Bean(name = "DUBBO")
@Scope("prototype")
@ConditionalOnMissingBean
public DubboJobDispatcherImpl jobByDubboType(ChronusSdkProcessor chronusSdkFacade) {
    DubboJobDispatcherImpl dubboJobDispatcher = new DubboJobDispatcherImpl(chronusSdkFacade);
    return dubboJobDispatcher;
}
 
源代码30 项目: mykit-delay   文件: HealthAutoConfiguration.java
@Bean
@Autowired(required = false)
@ConditionalOnMissingBean
public HealthIndicator jikexiuHealthIndicator(RedisQueue redisQueue, RedisQueueProperties properties) {
    CompositeHealthIndicator compositeHealthIndicator = new  CompositeHealthIndicator(healthAggregator);
    Map<String, LeaderManager> leaderManagerMap = AppEnvContext.getCtx().getBeansOfType(LeaderManager.class);
    LeaderManager manager = null;
    if (leaderManagerMap != null && !leaderManagerMap.isEmpty()) {
        manager = AppEnvContext.getCtx().getBean(SimpleLeaderManager.class);
    }

    compositeHealthIndicator.addHealthIndicator(Constants.HEALTH_INDICATOR_NAME, new QueueHealthIndicator(redisQueue, manager, properties));
    return compositeHealthIndicator;
}
 
 同包方法