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:57 UTC
[19/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-barcode-starter/src/main/java/org/apache/camel/dataformat/barcode/springboot/BarcodeDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-barcode-starter/src/main/java/org/apache/camel/dataformat/barcode/springboot/BarcodeDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-barcode-starter/src/main/java/org/apache/camel/dataformat/barcode/springboot/BarcodeDataFormatAutoConfiguration.java
index 73a2e3a..b4450b4 100644
--- a/platforms/spring-boot/components-starter/camel-barcode-starter/src/main/java/org/apache/camel/dataformat/barcode/springboot/BarcodeDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-barcode-starter/src/main/java/org/apache/camel/dataformat/barcode/springboot/BarcodeDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.barcode.BarcodeDataFormat;
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 BarcodeDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BarcodeDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BarcodeDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<BarcodeDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private BarcodeDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class BarcodeDataFormatAutoConfiguration {
}
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 BarcodeDataFormatAutoConfiguration {
} 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<BarcodeDataFormat> 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.barcode.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.barcode.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-base64-starter/src/main/java/org/apache/camel/dataformat/base64/springboot/Base64DataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-base64-starter/src/main/java/org/apache/camel/dataformat/base64/springboot/Base64DataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-base64-starter/src/main/java/org/apache/camel/dataformat/base64/springboot/Base64DataFormatAutoConfiguration.java
index acecd38..e44152f 100644
--- a/platforms/spring-boot/components-starter/camel-base64-starter/src/main/java/org/apache/camel/dataformat/base64/springboot/Base64DataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-base64-starter/src/main/java/org/apache/camel/dataformat/base64/springboot/Base64DataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.base64.Base64DataFormat;
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 Base64DataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(Base64DataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private Base64DataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<Base64DataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private Base64DataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class Base64DataFormatAutoConfiguration {
}
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 Base64DataFormatAutoConfiguration {
} 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<Base64DataFormat> 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.base64.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.base64.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-bean-validator-starter/src/main/java/org/apache/camel/component/bean/validator/springboot/BeanValidatorComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-bean-validator-starter/src/main/java/org/apache/camel/component/bean/validator/springboot/BeanValidatorComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-bean-validator-starter/src/main/java/org/apache/camel/component/bean/validator/springboot/BeanValidatorComponentAutoConfiguration.java
index 35eace1..55621c2 100644
--- a/platforms/spring-boot/components-starter/camel-bean-validator-starter/src/main/java/org/apache/camel/component/bean/validator/springboot/BeanValidatorComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-bean-validator-starter/src/main/java/org/apache/camel/component/bean/validator/springboot/BeanValidatorComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.bean.validator.BeanValidatorComponent;
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 BeanValidatorComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BeanValidatorComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BeanValidatorComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<BeanValidatorComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private BeanValidatorComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class BeanValidatorComponentAutoConfiguration {
BeanValidatorComponent component = new BeanValidatorComponent();
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 BeanValidatorComponentAutoConfiguration {
}
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<BeanValidatorComponent> 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.bean-validator.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.bean-validator.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-beanio-starter/src/main/java/org/apache/camel/dataformat/beanio/springboot/BeanIODataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-beanio-starter/src/main/java/org/apache/camel/dataformat/beanio/springboot/BeanIODataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-beanio-starter/src/main/java/org/apache/camel/dataformat/beanio/springboot/BeanIODataFormatAutoConfiguration.java
index bc6f2be..95b9d1a 100644
--- a/platforms/spring-boot/components-starter/camel-beanio-starter/src/main/java/org/apache/camel/dataformat/beanio/springboot/BeanIODataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-beanio-starter/src/main/java/org/apache/camel/dataformat/beanio/springboot/BeanIODataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.beanio.BeanIODataFormat;
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 BeanIODataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BeanIODataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BeanIODataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<BeanIODataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private BeanIODataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class BeanIODataFormatAutoConfiguration {
}
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 BeanIODataFormatAutoConfiguration {
} 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<BeanIODataFormat> 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.beanio.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.beanio.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-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentAutoConfiguration.java
index edf07fb..f4ab1f4 100644
--- a/platforms/spring-boot/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.beanstalk.BeanstalkComponent;
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 BeanstalkComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BeanstalkComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BeanstalkComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<BeanstalkComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private BeanstalkComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class BeanstalkComponentAutoConfiguration {
BeanstalkComponent component = new BeanstalkComponent();
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 BeanstalkComponentAutoConfiguration {
}
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<BeanstalkComponent> 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.beanstalk.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.beanstalk.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-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatAutoConfiguration.java
index e79289a..2c461b3 100644
--- a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat;
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 BindyCsvDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BindyCsvDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BindyCsvDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<BindyCsvDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private BindyCsvDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class BindyCsvDataFormatAutoConfiguration {
}
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,27 @@ public class BindyCsvDataFormatAutoConfiguration {
} 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<BindyCsvDataFormat> 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.bindy-csv.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.bindy-csv.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-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatAutoConfiguration.java
index 66381b3..ab8a60a 100644
--- a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat;
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 BindyFixedLengthDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BindyFixedLengthDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BindyFixedLengthDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<BindyFixedLengthDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private BindyFixedLengthDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class BindyFixedLengthDataFormatAutoConfiguration {
}
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,27 @@ public class BindyFixedLengthDataFormatAutoConfiguration {
} 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<BindyFixedLengthDataFormat> 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.bindy-fixed.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.bindy-fixed.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-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatAutoConfiguration.java
index 6b92e6c..ca861bc 100644
--- a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat;
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 BindyKeyValuePairDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BindyKeyValuePairDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BindyKeyValuePairDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<BindyKeyValuePairDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private BindyKeyValuePairDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class BindyKeyValuePairDataFormatAutoConfiguration {
}
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,27 @@ public class BindyKeyValuePairDataFormatAutoConfiguration {
} 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<BindyKeyValuePairDataFormat> 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.bindy-kvp.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.bindy-kvp.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-bonita-starter/src/main/java/org/apache/camel/component/bonita/springboot/BonitaComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-bonita-starter/src/main/java/org/apache/camel/component/bonita/springboot/BonitaComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-bonita-starter/src/main/java/org/apache/camel/component/bonita/springboot/BonitaComponentAutoConfiguration.java
index 51b5252..bd0b06c 100644
--- a/platforms/spring-boot/components-starter/camel-bonita-starter/src/main/java/org/apache/camel/component/bonita/springboot/BonitaComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-bonita-starter/src/main/java/org/apache/camel/component/bonita/springboot/BonitaComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.bonita.BonitaComponent;
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 BonitaComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BonitaComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BonitaComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<BonitaComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private BonitaComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class BonitaComponentAutoConfiguration {
BonitaComponent component = new BonitaComponent();
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 BonitaComponentAutoConfiguration {
}
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<BonitaComponent> 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.bonita.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.bonita.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-boon-starter/src/main/java/org/apache/camel/component/boon/springboot/BoonDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-boon-starter/src/main/java/org/apache/camel/component/boon/springboot/BoonDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-boon-starter/src/main/java/org/apache/camel/component/boon/springboot/BoonDataFormatAutoConfiguration.java
index f479cc8..8751a0c 100644
--- a/platforms/spring-boot/components-starter/camel-boon-starter/src/main/java/org/apache/camel/component/boon/springboot/BoonDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-boon-starter/src/main/java/org/apache/camel/component/boon/springboot/BoonDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.component.boon.BoonDataFormat;
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 BoonDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BoonDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BoonDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<BoonDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private BoonDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class BoonDataFormatAutoConfiguration {
}
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 BoonDataFormatAutoConfiguration {
} 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<BoonDataFormat> 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.boon.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.boon.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-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentAutoConfiguration.java
index 797d480..0a4da4a 100644
--- a/platforms/spring-boot/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.box.BoxComponent;
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 BoxComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BoxComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BoxComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<BoxComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private BoxComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class BoxComponentAutoConfiguration {
BoxComponent component = new BoxComponent();
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 BoxComponentAutoConfiguration {
}
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<BoxComponent> 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.box.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.box.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-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentAutoConfiguration.java
index 4220f2c..6981fd8 100644
--- a/platforms/spring-boot/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.braintree.BraintreeComponent;
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 BraintreeComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BraintreeComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BraintreeComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<BraintreeComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private BraintreeComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class BraintreeComponentAutoConfiguration {
BraintreeComponent component = new BraintreeComponent();
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 BraintreeComponentAutoConfiguration {
}
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<BraintreeComponent> 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.braintree.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.braintree.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-cache-starter/src/main/java/org/apache/camel/component/cache/springboot/CacheComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-cache-starter/src/main/java/org/apache/camel/component/cache/springboot/CacheComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-cache-starter/src/main/java/org/apache/camel/component/cache/springboot/CacheComponentAutoConfiguration.java
index 5229475..93694dd 100644
--- a/platforms/spring-boot/components-starter/camel-cache-starter/src/main/java/org/apache/camel/component/cache/springboot/CacheComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-cache-starter/src/main/java/org/apache/camel/component/cache/springboot/CacheComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.cache.CacheComponent;
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 CacheComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CacheComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CacheComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<CacheComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private CacheComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class CacheComponentAutoConfiguration {
CacheComponent component = new CacheComponent();
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 CacheComponentAutoConfiguration {
}
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<CacheComponent> 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.cache.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.cache.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-cassandraql-starter/src/main/java/org/apache/camel/component/cassandra/springboot/CassandraComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-cassandraql-starter/src/main/java/org/apache/camel/component/cassandra/springboot/CassandraComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-cassandraql-starter/src/main/java/org/apache/camel/component/cassandra/springboot/CassandraComponentAutoConfiguration.java
index a81881e..3cfb911 100644
--- a/platforms/spring-boot/components-starter/camel-cassandraql-starter/src/main/java/org/apache/camel/component/cassandra/springboot/CassandraComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-cassandraql-starter/src/main/java/org/apache/camel/component/cassandra/springboot/CassandraComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.cassandra.CassandraComponent;
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 CassandraComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CassandraComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CassandraComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<CassandraComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private CassandraComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class CassandraComponentAutoConfiguration {
CassandraComponent component = new CassandraComponent();
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 CassandraComponentAutoConfiguration {
}
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<CassandraComponent> 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.cql.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.cql.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-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java
index d9b1f9d..e4ccd73 100644
--- a/platforms/spring-boot/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.castor.CastorDataFormat;
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 CastorDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CastorDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CastorDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<CastorDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private CastorDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class CastorDataFormatAutoConfiguration {
}
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 CastorDataFormatAutoConfiguration {
} 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<CastorDataFormat> 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.castor.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.castor.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-chronicle-starter/src/main/java/org/apache/camel/component/chronicle/engine/springboot/ChronicleEngineComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-chronicle-starter/src/main/java/org/apache/camel/component/chronicle/engine/springboot/ChronicleEngineComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-chronicle-starter/src/main/java/org/apache/camel/component/chronicle/engine/springboot/ChronicleEngineComponentAutoConfiguration.java
index 79c5a74..adba8f7 100644
--- a/platforms/spring-boot/components-starter/camel-chronicle-starter/src/main/java/org/apache/camel/component/chronicle/engine/springboot/ChronicleEngineComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-chronicle-starter/src/main/java/org/apache/camel/component/chronicle/engine/springboot/ChronicleEngineComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.chronicle.engine.ChronicleEngineComponent;
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 ChronicleEngineComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ChronicleEngineComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ChronicleEngineComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ChronicleEngineComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ChronicleEngineComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class ChronicleEngineComponentAutoConfiguration {
ChronicleEngineComponent component = new ChronicleEngineComponent();
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 ChronicleEngineComponentAutoConfiguration {
}
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<ChronicleEngineComponent> 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.chronicle-engine.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.chronicle-engine.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;