You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2017/05/22 12:03:50 UTC
[12/21] camel git commit: camel-spring-boot: improve customizer
configuration
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/queue/springboot/HazelcastQueueComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/queue/springboot/HazelcastQueueComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/queue/springboot/HazelcastQueueComponentAutoConfiguration.java
index 18d9fc7..b584732 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/queue/springboot/HazelcastQueueComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/queue/springboot/HazelcastQueueComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.queue.HazelcastQueueComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HazelcastQueueComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastQueueComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastQueueComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastQueueComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastQueueComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastQueueComponentAutoConfiguration {
HazelcastQueueComponent component = new HazelcastQueueComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,23 @@ public class HazelcastQueueComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HazelcastQueueComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-queue.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-queue.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/springboot/HazelcastReplicatedmapComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/springboot/HazelcastReplicatedmapComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/springboot/HazelcastReplicatedmapComponentAutoConfiguration.java
index 7ddd97f..cf97aee 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/springboot/HazelcastReplicatedmapComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/springboot/HazelcastReplicatedmapComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.replicatedmap.HazelcastReplicatedmapComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HazelcastReplicatedmapComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastReplicatedmapComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastReplicatedmapComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastReplicatedmapComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastReplicatedmapComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastReplicatedmapComponentAutoConfiguration {
HazelcastReplicatedmapComponent component = new HazelcastReplicatedmapComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,24 @@ public class HazelcastReplicatedmapComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HazelcastReplicatedmapComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator
+ .evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-replicatedmap.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-replicatedmap.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentAutoConfiguration.java
index ede3f52..e8421f1 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.ringbuffer.HazelcastRingbufferComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HazelcastRingbufferComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastRingbufferComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastRingbufferComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastRingbufferComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastRingbufferComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastRingbufferComponentAutoConfiguration {
HazelcastRingbufferComponent component = new HazelcastRingbufferComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,24 @@ public class HazelcastRingbufferComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HazelcastRingbufferComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator
+ .evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-ringbuffer.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-ringbuffer.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentAutoConfiguration.java
index a6ad531..977de89 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.seda.HazelcastSedaComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HazelcastSedaComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastSedaComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastSedaComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastSedaComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastSedaComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastSedaComponentAutoConfiguration {
HazelcastSedaComponent component = new HazelcastSedaComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,23 @@ public class HazelcastSedaComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HazelcastSedaComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-seda.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-seda.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentAutoConfiguration.java
index c2d1c76..dfc6162 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.set.HazelcastSetComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HazelcastSetComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastSetComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastSetComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastSetComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastSetComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastSetComponentAutoConfiguration {
HazelcastSetComponent component = new HazelcastSetComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,23 @@ public class HazelcastSetComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HazelcastSetComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-set.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-set.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentAutoConfiguration.java
index e672b8f..085d72b 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.topic.HazelcastTopicComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HazelcastTopicComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastTopicComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastTopicComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastTopicComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastTopicComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastTopicComponentAutoConfiguration {
HazelcastTopicComponent component = new HazelcastTopicComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,23 @@ public class HazelcastTopicComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HazelcastTopicComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-topic.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-topic.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hbase-starter/src/main/java/org/apache/camel/component/hbase/springboot/HBaseComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hbase-starter/src/main/java/org/apache/camel/component/hbase/springboot/HBaseComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hbase-starter/src/main/java/org/apache/camel/component/hbase/springboot/HBaseComponentAutoConfiguration.java
index eb71588..e31282d 100644
--- a/platforms/spring-boot/components-starter/camel-hbase-starter/src/main/java/org/apache/camel/component/hbase/springboot/HBaseComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hbase-starter/src/main/java/org/apache/camel/component/hbase/springboot/HBaseComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hbase.HBaseComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HBaseComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HBaseComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HBaseComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HBaseComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HBaseComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class HBaseComponentAutoConfiguration {
HBaseComponent component = new HBaseComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class HBaseComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HBaseComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hbase.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hbase.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentAutoConfiguration.java
index 21c05d9..85fcd8a 100644
--- a/platforms/spring-boot/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hdfs.HdfsComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HdfsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HdfsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HdfsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HdfsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HdfsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class HdfsComponentAutoConfiguration {
HdfsComponent component = new HdfsComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class HdfsComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HdfsComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hdfs.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hdfs.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hdfs2-starter/src/main/java/org/apache/camel/component/hdfs2/springboot/HdfsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hdfs2-starter/src/main/java/org/apache/camel/component/hdfs2/springboot/HdfsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hdfs2-starter/src/main/java/org/apache/camel/component/hdfs2/springboot/HdfsComponentAutoConfiguration.java
index a98afb5..803359e 100644
--- a/platforms/spring-boot/components-starter/camel-hdfs2-starter/src/main/java/org/apache/camel/component/hdfs2/springboot/HdfsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hdfs2-starter/src/main/java/org/apache/camel/component/hdfs2/springboot/HdfsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hdfs2.HdfsComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HdfsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HdfsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HdfsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HdfsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HdfsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class HdfsComponentAutoConfiguration {
HdfsComponent component = new HdfsComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class HdfsComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HdfsComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hdfs2.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hdfs2.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java
index a409983..6476903 100644
--- a/platforms/spring-boot/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.hessian.HessianDataFormat;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatCustomizer;
import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -59,13 +62,13 @@ public class HessianDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HessianDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HessianDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<HessianDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private HessianDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class HessianDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,24 @@ public class HessianDataFormatAutoConfiguration {
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && dataformatConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (DataFormatCustomizer<HessianDataFormat> customizer : customizers) {
- LOGGER.debug(
- "Configure dataformat {}, with customizer {}",
- dataformat, customizer);
- customizer.customize(dataformat);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.hessian.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.hessian.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hipchat-starter/src/main/java/org/apache/camel/component/hipchat/springboot/HipchatComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hipchat-starter/src/main/java/org/apache/camel/component/hipchat/springboot/HipchatComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hipchat-starter/src/main/java/org/apache/camel/component/hipchat/springboot/HipchatComponentAutoConfiguration.java
index 96cf954..25ad274 100644
--- a/platforms/spring-boot/components-starter/camel-hipchat-starter/src/main/java/org/apache/camel/component/hipchat/springboot/HipchatComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hipchat-starter/src/main/java/org/apache/camel/component/hipchat/springboot/HipchatComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hipchat.HipchatComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HipchatComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HipchatComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HipchatComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HipchatComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HipchatComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class HipchatComponentAutoConfiguration {
HipchatComponent component = new HipchatComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class HipchatComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HipchatComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hipchat.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hipchat.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java
index 63f7139..5e552c2 100644
--- a/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.component.hl7.HL7DataFormat;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatCustomizer;
import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -59,13 +62,13 @@ public class HL7DataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HL7DataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HL7DataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<HL7DataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private HL7DataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class HL7DataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -98,15 +101,24 @@ public class HL7DataFormatAutoConfiguration {
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && dataformatConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (DataFormatCustomizer<HL7DataFormat> customizer : customizers) {
- LOGGER.debug(
- "Configure dataformat {}, with customizer {}",
- dataformat, customizer);
- customizer.customize(dataformat);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.hl7.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.hl7.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/TerserLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/TerserLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/TerserLanguageAutoConfiguration.java
index 01c0b46..ac46fdb 100644
--- a/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/TerserLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/TerserLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.component.hl7.TerserLanguage;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spi.LanguageCustomizer;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.LanguageConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -38,6 +40,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -58,13 +61,13 @@ public class TerserLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(TerserLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private TerserLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<TerserLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private TerserLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class TerserLanguageAutoConfiguration {
}
}
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(languageConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), language, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && languageConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (LanguageCustomizer<TerserLanguage> customizer : customizers) {
- LOGGER.debug("Configure language {}, with customizer {}",
- language, customizer);
- customizer.customize(language);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.terser.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.terser.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure language {}, with customizer {}",
+ language, customizer);
+ customizer.customize(language);
+ }
}
}
return language;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentAutoConfiguration.java
index 828ce41..72a66c6 100644
--- a/platforms/spring-boot/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.http.HttpComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HttpComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HttpComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HttpComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HttpComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HttpComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class HttpComponentAutoConfiguration {
HttpComponent component = new HttpComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class HttpComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HttpComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.http.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.http.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-http4-starter/src/main/java/org/apache/camel/component/http4/springboot/HttpComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-http4-starter/src/main/java/org/apache/camel/component/http4/springboot/HttpComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-http4-starter/src/main/java/org/apache/camel/component/http4/springboot/HttpComponentAutoConfiguration.java
index 634bcb0..da71aa9 100644
--- a/platforms/spring-boot/components-starter/camel-http4-starter/src/main/java/org/apache/camel/component/http4/springboot/HttpComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-http4-starter/src/main/java/org/apache/camel/component/http4/springboot/HttpComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.http4.HttpComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HttpComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HttpComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HttpComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HttpComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HttpComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class HttpComponentAutoConfiguration {
HttpComponent component = new HttpComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class HttpComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HttpComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.http4.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.http4.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java
index b232923..9abafa4 100644
--- a/platforms/spring-boot/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.component.ical.ICalDataFormat;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatCustomizer;
import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -59,13 +62,13 @@ public class ICalDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ICalDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ICalDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<ICalDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private ICalDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class ICalDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -98,15 +101,24 @@ public class ICalDataFormatAutoConfiguration {
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && dataformatConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (DataFormatCustomizer<ICalDataFormat> customizer : customizers) {
- LOGGER.debug(
- "Configure dataformat {}, with customizer {}",
- dataformat, customizer);
- customizer.customize(dataformat);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.ical.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.ical.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;