http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-soap-starter/src/main/java/org/apache/camel/dataformat/soap/springboot/SoapJaxbDataFormatAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-soap-starter/src/main/java/org/apache/camel/dataformat/soap/springboot/SoapJaxbDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-soap-starter/src/main/java/org/apache/camel/dataformat/soap/springboot/SoapJaxbDataFormatAutoConfiguration.java index 57f592b..9a213be 100644 --- a/platforms/spring-boot/components-starter/camel-soap-starter/src/main/java/org/apache/camel/dataformat/soap/springboot/SoapJaxbDataFormatAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-soap-starter/src/main/java/org/apache/camel/dataformat/soap/springboot/SoapJaxbDataFormatAutoConfiguration.java @@ -27,10 +27,12 @@ import org.apache.camel.dataformat.soap.SoapJaxbDataFormat; 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 SoapJaxbDataFormatAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SoapJaxbDataFormatAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SoapJaxbDataFormatConfiguration configuration; @Autowired(required = false) private List<DataFormatCustomizer<SoapJaxbDataFormat>> customizers; - @Autowired - private DataFormatConfigurationProperties globalConfiguration; - @Autowired - private SoapJaxbDataFormatConfiguration dataformatConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -91,7 +94,7 @@ public class SoapJaxbDataFormatAutoConfiguration { } 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 SoapJaxbDataFormatAutoConfiguration { } 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<SoapJaxbDataFormat> 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.soapjaxb.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.dataformat.customizer", + "camel.dataformat.soapjaxb.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-solr-starter/src/main/java/org/apache/camel/component/solr/springboot/SolrComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-solr-starter/src/main/java/org/apache/camel/component/solr/springboot/SolrComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-solr-starter/src/main/java/org/apache/camel/component/solr/springboot/SolrComponentAutoConfiguration.java index 28726ff..6ebf520 100644 --- a/platforms/spring-boot/components-starter/camel-solr-starter/src/main/java/org/apache/camel/component/solr/springboot/SolrComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-solr-starter/src/main/java/org/apache/camel/component/solr/springboot/SolrComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.solr.SolrComponent; 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 SolrComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SolrComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SolrComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<SolrComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private SolrComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class SolrComponentAutoConfiguration { SolrComponent component = new SolrComponent(); 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 SolrComponentAutoConfiguration { } 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<SolrComponent> 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.solr.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.solr.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-spark-starter/src/main/java/org/apache/camel/component/spark/springboot/SparkComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-spark-starter/src/main/java/org/apache/camel/component/spark/springboot/SparkComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spark-starter/src/main/java/org/apache/camel/component/spark/springboot/SparkComponentAutoConfiguration.java index 875b3f0..5af7e20 100644 --- a/platforms/spring-boot/components-starter/camel-spark-starter/src/main/java/org/apache/camel/component/spark/springboot/SparkComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-spark-starter/src/main/java/org/apache/camel/component/spark/springboot/SparkComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.spark.SparkComponent; 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 SparkComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SparkComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SparkComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<SparkComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private SparkComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class SparkComponentAutoConfiguration { SparkComponent component = new SparkComponent(); 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 SparkComponentAutoConfiguration { } 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<SparkComponent> 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.spark.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.spark.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-splunk-starter/src/main/java/org/apache/camel/component/splunk/springboot/SplunkComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-splunk-starter/src/main/java/org/apache/camel/component/splunk/springboot/SplunkComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-splunk-starter/src/main/java/org/apache/camel/component/splunk/springboot/SplunkComponentAutoConfiguration.java index 646635a..ba24f31 100644 --- a/platforms/spring-boot/components-starter/camel-splunk-starter/src/main/java/org/apache/camel/component/splunk/springboot/SplunkComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-splunk-starter/src/main/java/org/apache/camel/component/splunk/springboot/SplunkComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.splunk.SplunkComponent; 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 SplunkComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SplunkComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SplunkComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<SplunkComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private SplunkComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class SplunkComponentAutoConfiguration { SplunkComponent component = new SplunkComponent(); 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 SplunkComponentAutoConfiguration { } 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<SplunkComponent> 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.splunk.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.splunk.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-spring-batch-starter/src/main/java/org/apache/camel/component/spring/batch/springboot/SpringBatchComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-spring-batch-starter/src/main/java/org/apache/camel/component/spring/batch/springboot/SpringBatchComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-batch-starter/src/main/java/org/apache/camel/component/spring/batch/springboot/SpringBatchComponentAutoConfiguration.java index b41fa6b..340f2bd 100644 --- a/platforms/spring-boot/components-starter/camel-spring-batch-starter/src/main/java/org/apache/camel/component/spring/batch/springboot/SpringBatchComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-spring-batch-starter/src/main/java/org/apache/camel/component/spring/batch/springboot/SpringBatchComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.spring.batch.SpringBatchComponent; 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 SpringBatchComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SpringBatchComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SpringBatchComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<SpringBatchComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private SpringBatchComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -78,8 +81,8 @@ public class SpringBatchComponentAutoConfiguration { SpringBatchComponent component = new SpringBatchComponent(); 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 SpringBatchComponentAutoConfiguration { } 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<SpringBatchComponent> 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.spring-batch.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.spring-batch.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-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentAutoConfiguration.java index 931ae76..77cec19 100644 --- a/platforms/spring-boot/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.spring.integration.SpringIntegrationComponent; 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 SpringIntegrationComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SpringIntegrationComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SpringIntegrationComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<SpringIntegrationComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private SpringIntegrationComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -78,8 +81,8 @@ public class SpringIntegrationComponentAutoConfiguration { SpringIntegrationComponent component = new SpringIntegrationComponent(); 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 SpringIntegrationComponentAutoConfiguration { } 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<SpringIntegrationComponent> 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.spring-integration.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator + .evaluate(applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.spring-integration.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-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentAutoConfiguration.java index b38745e..c2bb0a7 100644 --- a/platforms/spring-boot/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.springldap.SpringLdapComponent; 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 SpringLdapComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SpringLdapComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SpringLdapComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<SpringLdapComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private SpringLdapComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class SpringLdapComponentAutoConfiguration { SpringLdapComponent component = new SpringLdapComponent(); 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 SpringLdapComponentAutoConfiguration { } 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<SpringLdapComponent> 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.spring-ldap.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.spring-ldap.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } } } return component; http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentAutoConfiguration.java index dfda106..4a8866c 100644 --- a/platforms/spring-boot/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.redis.RedisComponent; 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 RedisComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(RedisComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private RedisComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<RedisComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private RedisComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class RedisComponentAutoConfiguration { RedisComponent component = new RedisComponent(); 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 RedisComponentAutoConfiguration { } 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<RedisComponent> 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.spring-redis.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.spring-redis.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-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentAutoConfiguration.java index 5913693..c3f5d11 100644 --- a/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.event.EventComponent; 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 EventComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(EventComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private EventComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<EventComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private EventComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class EventComponentAutoConfiguration { EventComponent component = new EventComponent(); 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 EventComponentAutoConfiguration { } 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<EventComponent> 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.spring-event.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.spring-event.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } } } return component; http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/language/spel/springboot/SpelLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/language/spel/springboot/SpelLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/language/spel/springboot/SpelLanguageAutoConfiguration.java index cfbcf52..eba482b 100644 --- a/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/language/spel/springboot/SpelLanguageAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/language/spel/springboot/SpelLanguageAutoConfiguration.java @@ -23,11 +23,13 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.language.spel.SpelLanguage; +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 SpelLanguageAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SpelLanguageAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SpelLanguageConfiguration configuration; @Autowired(required = false) private List<LanguageCustomizer<SpelLanguage>> customizers; - @Autowired - private LanguageConfigurationProperties globalConfiguration; - @Autowired - private SpelLanguageConfiguration languageConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -85,18 +88,27 @@ public class SpelLanguageAutoConfiguration { } } 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<SpelLanguage> 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.spel.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.language.customizer", + "camel.language.spel.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-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentAutoConfiguration.java index a1cf2f7..2303407 100644 --- a/platforms/spring-boot/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.spring.ws.SpringWebserviceComponent; 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 SpringWebserviceComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SpringWebserviceComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SpringWebserviceComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<SpringWebserviceComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private SpringWebserviceComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -78,8 +81,8 @@ public class SpringWebserviceComponentAutoConfiguration { SpringWebserviceComponent component = new SpringWebserviceComponent(); 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 SpringWebserviceComponentAutoConfiguration { } 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<SpringWebserviceComponent> 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.spring-ws.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.spring-ws.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-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentAutoConfiguration.java index d860490..7002baa 100644 --- a/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.sql.SqlComponent; 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 SqlComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SqlComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SqlComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<SqlComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private SqlComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class SqlComponentAutoConfiguration { SqlComponent component = new SqlComponent(); 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 SqlComponentAutoConfiguration { } 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<SqlComponent> 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.sql.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.sql.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-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentAutoConfiguration.java index de71837..81d8c78 100644 --- a/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.sql.stored.SqlStoredComponent; 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 SqlStoredComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SqlStoredComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SqlStoredComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<SqlStoredComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private SqlStoredComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class SqlStoredComponentAutoConfiguration { SqlStoredComponent component = new SqlStoredComponent(); 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 SqlStoredComponentAutoConfiguration { } 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<SqlStoredComponent> 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.sql-stored.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.sql-stored.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-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentAutoConfiguration.java index 7d380c2..4910975 100644 --- a/platforms/spring-boot/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.ssh.SshComponent; 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 SshComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(SshComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private SshComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<SshComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private SshComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class SshComponentAutoConfiguration { SshComponent component = new SshComponent(); 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 SshComponentAutoConfiguration { } 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<SshComponent> 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.ssh.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.ssh.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-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentAutoConfiguration.java index 02003c1..a07f730 100644 --- a/platforms/spring-boot/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.stax.StAXComponent; 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 StAXComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(StAXComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private StAXComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<StAXComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private StAXComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class StAXComponentAutoConfiguration { StAXComponent component = new StAXComponent(); 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 StAXComponentAutoConfiguration { } 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<StAXComponent> 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.stax.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.stax.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-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentAutoConfiguration.java index c493428..665aac3 100644 --- a/platforms/spring-boot/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.stomp.StompComponent; 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 StompComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(StompComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private StompComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<StompComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private StompComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class StompComponentAutoConfiguration { StompComponent component = new StompComponent(); 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 StompComponentAutoConfiguration { } 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<StompComponent> 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.stomp.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.stomp.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } } } return component;
