Java Code Examples for org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
The following examples show how to use
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: jeecg-boot-with-activiti Source File: AliYunOSSAutoConfiguration.java License: MIT License | 6 votes |
@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; }
Example 2
Source Project: xmall Source File: JacksonConfig.java License: MIT License | 6 votes |
@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; }
Example 3
Source Project: frostmourne Source File: FrostmourneSpiAutoConfiguration.java License: MIT License | 6 votes |
@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()); }
Example 4
Source Project: staffjoy Source File: FaradayConfiguration.java License: MIT License | 6 votes |
@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); } }
Example 5
Source Project: magic-starter Source File: MinIoAutoConfiguration.java License: GNU Lesser General Public License v3.0 | 5 votes |
@Bean @SneakyThrows @ConditionalOnMissingBean public MinioClient minioClient() { return new MinioClient(ossProperties.getMinIo() .getEndpoint(), ossProperties.getMinIo() .getAccessKey(), ossProperties.getMinIo() .getSecretKey()); }
Example 6
Source Project: camel-spring-boot Source File: DropboxComponentAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 7
Source Project: camel-spring-boot Source File: ServletComponentAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 8
Source Project: fw-spring-cloud Source File: DroolsConfig.java License: Apache License 2.0 | 5 votes |
@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()); }
Example 9
Source Project: camel-spring-boot Source File: KMSComponentAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 10
Source Project: beihu-boot Source File: ApiBootMyBatisEnhanceAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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); } }
Example 11
Source Project: Spring-Boot-Book Source File: MyStarterServiceAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@Bean /** * Description: 当容器中没有指定Bean的情况下,自动配置MyStarterService类 */ @ConditionalOnMissingBean(MyStarter.class) public MyStarter MyStarterService(){ MyStarter myStarterService = new MyStarter(myproperties); return myStarterService; }
Example 12
Source Project: Java-programming-methodology-Rxjava-articles Source File: RxJavaMvcAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@Bean @RxMVC @ConditionalOnMissingBean @ConditionalOnClass(Observable.class) public ObservableReturnValueHandler observableReturnValueHandler() { return new ObservableReturnValueHandler(); }
Example 13
Source Project: camel-spring-boot Source File: SpringLdapComponentAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 14
Source Project: camel-spring-boot Source File: AhcComponentAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 15
Source Project: codeway_service Source File: JsonRedisSerializable.java License: GNU General Public License v3.0 | 5 votes |
/** * 配置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; }
Example 16
Source Project: spring-boot-starter-micro-job Source File: JobQuartzAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 17
Source Project: camel-spring-boot Source File: CryptoCmsComponentAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 18
Source Project: camel-spring-boot Source File: SnsComponentAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 19
Source Project: camel-spring-boot Source File: DisruptorVmComponentAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 20
Source Project: camel-spring-boot Source File: IPFSComponentAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 21
Source Project: camel-spring-boot Source File: OpenshiftBuildsComponentAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 22
Source Project: springdoc-openapi Source File: SpringDocConfiguration.java License: Apache License 2.0 | 5 votes |
/** * Polymorphic model converter polymorphic model converter. * * @return the polymorphic model converter */ @Bean @ConditionalOnMissingBean @Lazy(false) PolymorphicModelConverter polymorphicModelConverter() { return new PolymorphicModelConverter(); }
Example 23
Source Project: sqlhelper Source File: JdbcTemplateAutoConfiguration.java License: GNU Lesser General Public License v3.0 | 5 votes |
@Bean @Primary @ConditionalOnSingleCandidate(JdbcTemplate.class) @ConditionalOnMissingBean(NamedParameterJdbcOperations.class) public NamedParameterJdbcTemplate namedParameterJdbcTemplate(JdbcTemplate jdbcTemplate) { return new NamedParameterJdbcTemplate(jdbcTemplate); }
Example 24
Source Project: camel-spring-boot Source File: ServiceNowComponentAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 25
Source Project: camel-spring-boot Source File: DataSetTestComponentAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 26
Source Project: camel-spring-boot Source File: DataSetComponentAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 27
Source Project: camel-spring-boot Source File: GoogleSheetsComponentAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 28
Source Project: camel-spring-boot Source File: VmComponentAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }
Example 29
Source Project: chronus Source File: DubboConfiguration.java License: Apache License 2.0 | 5 votes |
@Bean(name = "DUBBO") @Scope("prototype") @ConditionalOnMissingBean public DubboJobDispatcherImpl jobByDubboType(ChronusSdkProcessor chronusSdkFacade) { DubboJobDispatcherImpl dubboJobDispatcher = new DubboJobDispatcherImpl(chronusSdkFacade); return dubboJobDispatcher; }
Example 30
Source Project: mykit-delay Source File: HealthAutoConfiguration.java License: Apache License 2.0 | 5 votes |
@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; }