org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean Java Examples
The following examples show how to use
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean.
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 File: JacksonConfig.java From xmall with MIT License | 7 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 #2
Source File: FaradayConfiguration.java From staffjoy with 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 #3
Source File: FrostmourneSpiAutoConfiguration.java From frostmourne with 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 File: AliYunOSSAutoConfiguration.java From jeecg-boot-with-activiti with 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 #5
Source File: FlinkComponentAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Lazy @Bean(name = "flink-component") @ConditionalOnMissingBean(FlinkComponent.class) public FlinkComponent configureFlinkComponent() throws Exception { FlinkComponent component = new FlinkComponent(); 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<FlinkComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.flink.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.flink.customizer"); if (useCustomizer) { LOGGER.debug("Configure component {}, with customizer {}", component, customizer); customizer.customize(component); } } } return component; }
Example #6
Source File: SpringDocConfiguration.java From springdoc-openapi with Apache License 2.0 | 5 votes |
/** * Response support converter response support converter. * * @return the response support converter */ @Bean @ConditionalOnMissingBean @Lazy(false) ResponseSupportConverter responseSupportConverter() { return new ResponseSupportConverter(); }
Example #7
Source File: GuavaEventBusComponentAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Lazy @Bean(name = "guava-eventbus-component") @ConditionalOnMissingBean(GuavaEventBusComponent.class) public GuavaEventBusComponent configureGuavaEventBusComponent() throws Exception { GuavaEventBusComponent component = new GuavaEventBusComponent(); 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<GuavaEventBusComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.guava-eventbus.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.guava-eventbus.customizer"); if (useCustomizer) { LOGGER.debug("Configure component {}, with customizer {}", component, customizer); customizer.customize(component); } } } return component; }
Example #8
Source File: AdminServerDiscoveryAutoConfiguration.java From Moss with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean @ConfigurationProperties(prefix = "spring.boot.admin.discovery") public InstanceDiscoveryListener instanceDiscoveryListener(ServiceInstanceConverter serviceInstanceConverter, DiscoveryClient discoveryClient, InstanceRegistry registry, InstanceRepository repository) { InstanceDiscoveryListener listener = new InstanceDiscoveryListener(discoveryClient, registry, repository); listener.setConverter(serviceInstanceConverter); return listener; }
Example #9
Source File: JcrComponentAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Lazy @Bean(name = "jcr-component") @ConditionalOnMissingBean(JcrComponent.class) public JcrComponent configureJcrComponent() throws Exception { JcrComponent component = new JcrComponent(); 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<JcrComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.jcr.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.jcr.customizer"); if (useCustomizer) { LOGGER.debug("Configure component {}, with customizer {}", component, customizer); customizer.customize(component); } } } return component; }
Example #10
Source File: StringTemplateComponentAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Lazy @Bean(name = "string-template-component") @ConditionalOnMissingBean(StringTemplateComponent.class) public StringTemplateComponent configureStringTemplateComponent() throws Exception { StringTemplateComponent component = new StringTemplateComponent(); 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<StringTemplateComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.string-template.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.string-template.customizer"); if (useCustomizer) { LOGGER.debug("Configure component {}, with customizer {}", component, customizer); customizer.customize(component); } } } return component; }
Example #11
Source File: BeanLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "bean-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(BeanLanguage.class) public BeanLanguage configureBeanLanguage() throws Exception { BeanLanguage language = new BeanLanguage(); if (CamelContextAware.class.isAssignableFrom(BeanLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<BeanLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.bean.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.bean.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #12
Source File: ShiroConfig.java From frpMgr with MIT License | 5 votes |
/** * Apache Shiro Filter * @throws Exception */ @Bean @Order(3000) @ConditionalOnMissingBean(name="shiroFilterProxy") public FilterRegistrationBean shiroFilterProxy(ShiroFilterFactoryBean shiroFilter) throws Exception { FilterRegistrationBean bean = new FilterRegistrationBean(); bean.setFilter((Filter) shiroFilter.getInstance()); bean.addUrlPatterns("/*"); return bean; }
Example #13
Source File: FeignAutoConfiguration.java From open-cloud with MIT License | 5 votes |
@Bean @ConditionalOnMissingBean(FeignRequestInterceptor.class) public RequestInterceptor feignRequestInterceptor() { FeignRequestInterceptor interceptor = new FeignRequestInterceptor(); log.info("FeignRequestInterceptor [{}]", interceptor); return interceptor; }
Example #14
Source File: FaradayConfiguration.java From staffjoy with MIT License | 5 votes |
@Bean @ConditionalOnMissingBean public RequestForwarder faradayRequestForwarder( HttpClientProvider httpClientProvider, MappingsProvider mappingsProvider, LoadBalancer loadBalancer, Optional<MeterRegistry> meterRegistry, ProxyingTraceInterceptor traceInterceptor, PostForwardResponseInterceptor responseInterceptor ) { return new RequestForwarder( serverProperties, faradayProperties, httpClientProvider, mappingsProvider, loadBalancer, meterRegistry, traceInterceptor, responseInterceptor); }
Example #15
Source File: DigitalOceanComponentAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Lazy @Bean(name = "digitalocean-component") @ConditionalOnMissingBean(DigitalOceanComponent.class) public DigitalOceanComponent configureDigitalOceanComponent() throws Exception { DigitalOceanComponent component = new DigitalOceanComponent(); 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<DigitalOceanComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.digitalocean.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.digitalocean.customizer"); if (useCustomizer) { LOGGER.debug("Configure component {}, with customizer {}", component, customizer); customizer.customize(component); } } } return component; }
Example #16
Source File: KubernetesDeploymentsComponentAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Lazy @Bean(name = "kubernetes-deployments-component") @ConditionalOnMissingBean(KubernetesDeploymentsComponent.class) public KubernetesDeploymentsComponent configureKubernetesDeploymentsComponent() throws Exception { KubernetesDeploymentsComponent component = new KubernetesDeploymentsComponent(); 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<KubernetesDeploymentsComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.kubernetes-deployments.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.kubernetes-deployments.customizer"); if (useCustomizer) { LOGGER.debug("Configure component {}, with customizer {}", component, customizer); customizer.customize(component); } } } return component; }
Example #17
Source File: IgniteCacheComponentAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Lazy @Bean(name = "ignite-cache-component") @ConditionalOnMissingBean(IgniteCacheComponent.class) public IgniteCacheComponent configureIgniteCacheComponent() throws Exception { IgniteCacheComponent component = new IgniteCacheComponent(); 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<IgniteCacheComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.ignite-cache.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.ignite-cache.customizer"); if (useCustomizer) { LOGGER.debug("Configure component {}, with customizer {}", component, customizer); customizer.customize(component); } } } return component; }
Example #18
Source File: AdminServerAutoConfiguration.java From Moss with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean public EndpointDetector endpointDetector(InstanceRepository instanceRepository, InstanceWebClient instanceWebClient) { ChainingStrategy strategy = new ChainingStrategy( new QueryIndexEndpointStrategy(instanceWebClient), new ProbeEndpointsStrategy(instanceWebClient, adminServerProperties.getProbedEndpoints()) ); return new EndpointDetector(instanceRepository, strategy); }
Example #19
Source File: ApiBootRateLimiterAutoConfiguration.java From api-boot with Apache License 2.0 | 5 votes |
/** * default config centre * * @return RateLimiterConfigCentre */ @Bean @ConditionalOnMissingBean @ConditionalOnMissingClass({"com.alibaba.boot.nacos.config.properties.NacosConfigProperties"}) public RateLimiterConfigCentre defaultRateLimiterConfigCentre() { return new DefaultRateLimiterConfigCentre(); }
Example #20
Source File: ServiceComponentAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Lazy @Bean(name = "service-component") @ConditionalOnMissingBean(ServiceComponent.class) public ServiceComponent configureServiceComponent() throws Exception { ServiceComponent component = new ServiceComponent(); 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<ServiceComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.service.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.service.customizer"); if (useCustomizer) { LOGGER.debug("Configure component {}, with customizer {}", component, customizer); customizer.customize(component); } } } return component; }
Example #21
Source File: DockerComponentAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Lazy @Bean(name = "docker-component") @ConditionalOnMissingBean(DockerComponent.class) public DockerComponent configureDockerComponent() throws Exception { DockerComponent component = new DockerComponent(); 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<DockerComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.docker.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.docker.customizer"); if (useCustomizer) { LOGGER.debug("Configure component {}, with customizer {}", component, customizer); customizer.customize(component); } } } return component; }
Example #22
Source File: ShiroConfig.java From fastdep with Apache License 2.0 | 5 votes |
/** * shiroFilter * * @param securityManager securityManager bean * @param jwtUtil jwt util bean * @return shiroFilter */ @Bean("shiroFilter") @ConditionalOnMissingBean(ShiroFilter.class) public ShiroFilterFactoryBean factory(DefaultWebSecurityManager securityManager, JwtUtil jwtUtil) { FastDepShiroJwtProperties fastDepShiroJwtProperties = jwtUtil.fastDepShiroJwtProperties; ShiroFilterFactoryBean factoryBean = new ShiroFilterFactoryBean(); // define your filter and name it as jwt Map<String, Filter> filterMap = new HashMap<>(1); filterMap.put("jwt", new JwtFilter(jwtUtil)); factoryBean.setFilters(filterMap); factoryBean.setSecurityManager(securityManager); /* * difine custom URL rule * http://shiro.apache.org/web.html#urls- */ Map<String, FastDepShiroJwtProperties.ShiroRole> filter = fastDepShiroJwtProperties.getFilter(); if (filter.size() > 0) { LinkedHashMap<String, String> filterRuleMap = filter.values().stream(). collect(Collectors.toMap(FastDepShiroJwtProperties.ShiroRole::getPath, FastDepShiroJwtProperties.ShiroRole::getRole, (key1, key2) -> key2, LinkedHashMap::new)); // 401 and 404 page does not forward to our filter factoryBean.setFilterChainDefinitionMap(filterRuleMap); } if (fastDepShiroJwtProperties.getFilterChainDefinitions() != null) { factoryBean.setFilterChainDefinitions(fastDepShiroJwtProperties.getFilterChainDefinitions()); } factoryBean.setLoginUrl(fastDepShiroJwtProperties.getLoginUrl()); factoryBean.setSuccessUrl(fastDepShiroJwtProperties.getSuccessUrl()); factoryBean.setUnauthorizedUrl(fastDepShiroJwtProperties.getUnauthorizedUrl()); jwtUtil.fastDepShiroJwtAuthorization.shiroFilterFactoryBean(factoryBean); return factoryBean; }
Example #23
Source File: OpenshiftBuildConfigsComponentAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Lazy @Bean(name = "openshift-build-configs-component") @ConditionalOnMissingBean(OpenshiftBuildConfigsComponent.class) public OpenshiftBuildConfigsComponent configureOpenshiftBuildConfigsComponent() throws Exception { OpenshiftBuildConfigsComponent component = new OpenshiftBuildConfigsComponent(); 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<OpenshiftBuildConfigsComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.openshift-build-configs.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.openshift-build-configs.customizer"); if (useCustomizer) { LOGGER.debug("Configure component {}, with customizer {}", component, customizer); customizer.customize(component); } } } return component; }
Example #24
Source File: ApiBootMyBatisEnhanceAutoConfiguration.java From api-boot with 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 #25
Source File: EventComponentAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Lazy @Bean(name = "spring-event-component") @ConditionalOnMissingBean(EventComponent.class) public EventComponent configureEventComponent() throws Exception { EventComponent component = new EventComponent(); 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<EventComponent> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.spring-event.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.component.customizer", "camel.component.spring-event.customizer"); if (useCustomizer) { LOGGER.debug("Configure component {}, with customizer {}", component, customizer); customizer.customize(component); } } } return component; }
Example #26
Source File: MinIoAutoConfiguration.java From magic-starter with 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 #27
Source File: DubboConfiguration.java From chronus with 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 #28
Source File: VmComponentAutoConfiguration.java From camel-spring-boot with 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 File: GoogleSheetsComponentAutoConfiguration.java From camel-spring-boot with 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 #30
Source File: DataSetComponentAutoConfiguration.java From camel-spring-boot with 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; }