http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-milo-starter/src/main/java/org/apache/camel/component/milo/server/springboot/MiloServerComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-milo-starter/src/main/java/org/apache/camel/component/milo/server/springboot/MiloServerComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-milo-starter/src/main/java/org/apache/camel/component/milo/server/springboot/MiloServerComponentAutoConfiguration.java index 3a07386..fa4ec12 100644 --- a/platforms/spring-boot/components-starter/camel-milo-starter/src/main/java/org/apache/camel/component/milo/server/springboot/MiloServerComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-milo-starter/src/main/java/org/apache/camel/component/milo/server/springboot/MiloServerComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.milo.server.MiloServerComponent; 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 MiloServerComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(MiloServerComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private MiloServerComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<MiloServerComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private MiloServerComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class MiloServerComponentAutoConfiguration { MiloServerComponent component = new MiloServerComponent(); 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 MiloServerComponentAutoConfiguration { } 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<MiloServerComponent> 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.milo-server.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.milo-server.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-mina2-starter/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-mina2-starter/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mina2-starter/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentAutoConfiguration.java index 6240f5c..61eb80e 100644 --- a/platforms/spring-boot/components-starter/camel-mina2-starter/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-mina2-starter/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.mina2.Mina2Component; 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 Mina2ComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(Mina2ComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private Mina2ComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<Mina2Component>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private Mina2ComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class Mina2ComponentAutoConfiguration { Mina2Component component = new Mina2Component(); 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 Mina2ComponentAutoConfiguration { } 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<Mina2Component> 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.mina2.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.mina2.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-mllp-starter/src/main/java/org/apache/camel/component/mllp/springboot/MllpComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-mllp-starter/src/main/java/org/apache/camel/component/mllp/springboot/MllpComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mllp-starter/src/main/java/org/apache/camel/component/mllp/springboot/MllpComponentAutoConfiguration.java index cb726c1..2722c75 100644 --- a/platforms/spring-boot/components-starter/camel-mllp-starter/src/main/java/org/apache/camel/component/mllp/springboot/MllpComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-mllp-starter/src/main/java/org/apache/camel/component/mllp/springboot/MllpComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.mllp.MllpComponent; 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 MllpComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(MllpComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private MllpComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<MllpComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private MllpComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class MllpComponentAutoConfiguration { MllpComponent component = new MllpComponent(); 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 MllpComponentAutoConfiguration { } 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<MllpComponent> 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.mllp.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.mllp.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-mongodb-gridfs-starter/src/main/java/org/apache/camel/component/mongodb/gridfs/springboot/GridFsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-mongodb-gridfs-starter/src/main/java/org/apache/camel/component/mongodb/gridfs/springboot/GridFsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mongodb-gridfs-starter/src/main/java/org/apache/camel/component/mongodb/gridfs/springboot/GridFsComponentAutoConfiguration.java index e7e2bc0..3538c53 100644 --- a/platforms/spring-boot/components-starter/camel-mongodb-gridfs-starter/src/main/java/org/apache/camel/component/mongodb/gridfs/springboot/GridFsComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-mongodb-gridfs-starter/src/main/java/org/apache/camel/component/mongodb/gridfs/springboot/GridFsComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.mongodb.gridfs.GridFsComponent; 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 GridFsComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(GridFsComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private GridFsComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<GridFsComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private GridFsComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class GridFsComponentAutoConfiguration { GridFsComponent component = new GridFsComponent(); 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 GridFsComponentAutoConfiguration { } 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<GridFsComponent> 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.mongodb-gridfs.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.mongodb-gridfs.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-mongodb-starter/src/main/java/org/apache/camel/component/mongodb/springboot/MongoDbComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-mongodb-starter/src/main/java/org/apache/camel/component/mongodb/springboot/MongoDbComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mongodb-starter/src/main/java/org/apache/camel/component/mongodb/springboot/MongoDbComponentAutoConfiguration.java index a0690ea..122231a 100644 --- a/platforms/spring-boot/components-starter/camel-mongodb-starter/src/main/java/org/apache/camel/component/mongodb/springboot/MongoDbComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-mongodb-starter/src/main/java/org/apache/camel/component/mongodb/springboot/MongoDbComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.mongodb.MongoDbComponent; 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 MongoDbComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(MongoDbComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private MongoDbComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<MongoDbComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private MongoDbComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class MongoDbComponentAutoConfiguration { MongoDbComponent component = new MongoDbComponent(); 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 MongoDbComponentAutoConfiguration { } 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<MongoDbComponent> 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.mongodb.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.mongodb.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-mongodb3-starter/src/main/java/org/apache/camel/component/mongodb3/springboot/MongoDbComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-mongodb3-starter/src/main/java/org/apache/camel/component/mongodb3/springboot/MongoDbComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mongodb3-starter/src/main/java/org/apache/camel/component/mongodb3/springboot/MongoDbComponentAutoConfiguration.java index 9258da9..7a40540 100644 --- a/platforms/spring-boot/components-starter/camel-mongodb3-starter/src/main/java/org/apache/camel/component/mongodb3/springboot/MongoDbComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-mongodb3-starter/src/main/java/org/apache/camel/component/mongodb3/springboot/MongoDbComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.mongodb3.MongoDbComponent; 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 MongoDbComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(MongoDbComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private MongoDbComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<MongoDbComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private MongoDbComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class MongoDbComponentAutoConfiguration { MongoDbComponent component = new MongoDbComponent(); 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 MongoDbComponentAutoConfiguration { } 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<MongoDbComponent> 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.mongodb3.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.mongodb3.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-mqtt-starter/src/main/java/org/apache/camel/component/mqtt/springboot/MQTTComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-mqtt-starter/src/main/java/org/apache/camel/component/mqtt/springboot/MQTTComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mqtt-starter/src/main/java/org/apache/camel/component/mqtt/springboot/MQTTComponentAutoConfiguration.java index dc86cc2..010cdd4 100644 --- a/platforms/spring-boot/components-starter/camel-mqtt-starter/src/main/java/org/apache/camel/component/mqtt/springboot/MQTTComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-mqtt-starter/src/main/java/org/apache/camel/component/mqtt/springboot/MQTTComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.mqtt.MQTTComponent; 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 MQTTComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(MQTTComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private MQTTComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<MQTTComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private MQTTComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class MQTTComponentAutoConfiguration { MQTTComponent component = new MQTTComponent(); 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 MQTTComponentAutoConfiguration { } 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<MQTTComponent> 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.mqtt.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.mqtt.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-msv-starter/src/main/java/org/apache/camel/component/validator/msv/springboot/MsvComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-msv-starter/src/main/java/org/apache/camel/component/validator/msv/springboot/MsvComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-msv-starter/src/main/java/org/apache/camel/component/validator/msv/springboot/MsvComponentAutoConfiguration.java index 59e7ee6..81754e9 100644 --- a/platforms/spring-boot/components-starter/camel-msv-starter/src/main/java/org/apache/camel/component/validator/msv/springboot/MsvComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-msv-starter/src/main/java/org/apache/camel/component/validator/msv/springboot/MsvComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.validator.msv.MsvComponent; 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 MsvComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(MsvComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private MsvComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<MsvComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private MsvComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class MsvComponentAutoConfiguration { MsvComponent component = new MsvComponent(); 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 MsvComponentAutoConfiguration { } 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<MsvComponent> 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.msv.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.msv.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-mustache-starter/src/main/java/org/apache/camel/component/mustache/springboot/MustacheComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-mustache-starter/src/main/java/org/apache/camel/component/mustache/springboot/MustacheComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mustache-starter/src/main/java/org/apache/camel/component/mustache/springboot/MustacheComponentAutoConfiguration.java index 24debe1..f61a638 100644 --- a/platforms/spring-boot/components-starter/camel-mustache-starter/src/main/java/org/apache/camel/component/mustache/springboot/MustacheComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-mustache-starter/src/main/java/org/apache/camel/component/mustache/springboot/MustacheComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.mustache.MustacheComponent; 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 MustacheComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(MustacheComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private MustacheComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<MustacheComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private MustacheComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class MustacheComponentAutoConfiguration { MustacheComponent component = new MustacheComponent(); 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 MustacheComponentAutoConfiguration { } 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<MustacheComponent> 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.mustache.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.mustache.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-mvel-starter/src/main/java/org/apache/camel/component/mvel/springboot/MvelComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/component/mvel/springboot/MvelComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/component/mvel/springboot/MvelComponentAutoConfiguration.java index 37435a3..3f43e2b 100644 --- a/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/component/mvel/springboot/MvelComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/component/mvel/springboot/MvelComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.mvel.MvelComponent; 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 MvelComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(MvelComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private MvelComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<MvelComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private MvelComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class MvelComponentAutoConfiguration { MvelComponent component = new MvelComponent(); 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 MvelComponentAutoConfiguration { } 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<MvelComponent> 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.mvel.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.mvel.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-mvel-starter/src/main/java/org/apache/camel/language/mvel/springboot/MvelLanguageAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/language/mvel/springboot/MvelLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/language/mvel/springboot/MvelLanguageAutoConfiguration.java index 29124e8..a3d46be 100644 --- a/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/language/mvel/springboot/MvelLanguageAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-mvel-starter/src/main/java/org/apache/camel/language/mvel/springboot/MvelLanguageAutoConfiguration.java @@ -23,11 +23,13 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.CamelContextAware; import org.apache.camel.language.mvel.MvelLanguage; +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 MvelLanguageAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(MvelLanguageAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private MvelLanguageConfiguration configuration; @Autowired(required = false) private List<LanguageCustomizer<MvelLanguage>> customizers; - @Autowired - private LanguageConfigurationProperties globalConfiguration; - @Autowired - private MvelLanguageConfiguration languageConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -85,18 +88,27 @@ public class MvelLanguageAutoConfiguration { } } 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<MvelLanguage> 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.mvel.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.language.customizer", + "camel.language.mvel.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-mybatis-starter/src/main/java/org/apache/camel/component/mybatis/springboot/MyBatisComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-mybatis-starter/src/main/java/org/apache/camel/component/mybatis/springboot/MyBatisComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mybatis-starter/src/main/java/org/apache/camel/component/mybatis/springboot/MyBatisComponentAutoConfiguration.java index 5294480..8f03df7 100644 --- a/platforms/spring-boot/components-starter/camel-mybatis-starter/src/main/java/org/apache/camel/component/mybatis/springboot/MyBatisComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-mybatis-starter/src/main/java/org/apache/camel/component/mybatis/springboot/MyBatisComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.mybatis.MyBatisComponent; 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 MyBatisComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(MyBatisComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private MyBatisComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<MyBatisComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private MyBatisComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class MyBatisComponentAutoConfiguration { MyBatisComponent component = new MyBatisComponent(); 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 MyBatisComponentAutoConfiguration { } 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<MyBatisComponent> 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.mybatis.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.mybatis.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-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentAutoConfiguration.java index 86e5b65..a5f3919 100644 --- a/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.nagios.NagiosComponent; 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 NagiosComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(NagiosComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private NagiosComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<NagiosComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private NagiosComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class NagiosComponentAutoConfiguration { NagiosComponent component = new NagiosComponent(); 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 NagiosComponentAutoConfiguration { } 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<NagiosComponent> 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.nagios.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.nagios.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-nats-starter/src/main/java/org/apache/camel/component/nats/springboot/NatsComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-nats-starter/src/main/java/org/apache/camel/component/nats/springboot/NatsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-nats-starter/src/main/java/org/apache/camel/component/nats/springboot/NatsComponentAutoConfiguration.java index 28fbc81..8609c35 100644 --- a/platforms/spring-boot/components-starter/camel-nats-starter/src/main/java/org/apache/camel/component/nats/springboot/NatsComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-nats-starter/src/main/java/org/apache/camel/component/nats/springboot/NatsComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.nats.NatsComponent; 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 NatsComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(NatsComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private NatsComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<NatsComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private NatsComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class NatsComponentAutoConfiguration { NatsComponent component = new NatsComponent(); 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 NatsComponentAutoConfiguration { } 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<NatsComponent> 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.nats.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.nats.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-netty-http-starter/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-netty-http-starter/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-netty-http-starter/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentAutoConfiguration.java index 5a84f32..fc2ef88 100644 --- a/platforms/spring-boot/components-starter/camel-netty-http-starter/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-netty-http-starter/src/main/java/org/apache/camel/component/netty/http/springboot/NettyHttpComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.netty.http.NettyHttpComponent; 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 NettyHttpComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(NettyHttpComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private NettyHttpComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<NettyHttpComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private NettyHttpComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class NettyHttpComponentAutoConfiguration { NettyHttpComponent component = new NettyHttpComponent(); 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 NettyHttpComponentAutoConfiguration { } 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<NettyHttpComponent> 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.netty-http.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.netty-http.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } } } return component; http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentAutoConfiguration.java index ea3d374..db7623e 100644 --- a/platforms/spring-boot/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentAutoConfiguration.java @@ -23,10 +23,12 @@ import javax.annotation.Generated; import org.apache.camel.CamelContext; import org.apache.camel.component.netty.NettyComponent; 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 NettyComponentAutoConfiguration { private static final Logger LOGGER = LoggerFactory .getLogger(NettyComponentAutoConfiguration.class); @Autowired + private ApplicationContext applicationContext; + @Autowired private CamelContext camelContext; + @Autowired + private NettyComponentConfiguration configuration; @Autowired(required = false) private List<ComponentCustomizer<NettyComponent>> customizers; - @Autowired - private ComponentConfigurationProperties globalConfiguration; - @Autowired - private NettyComponentConfiguration componentConfiguration; static class GroupConditions extends GroupCondition { public GroupConditions() { @@ -77,8 +80,8 @@ public class NettyComponentAutoConfiguration { NettyComponent component = new NettyComponent(); 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 NettyComponentAutoConfiguration { } 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<NettyComponent> 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.netty.customizer", + ((HasId) customizer).getId()) + : HierarchicalPropertiesEvaluator.evaluate( + applicationContext.getEnvironment(), + "camel.component.customizer", + "camel.component.netty.customizer"); + if (useCustomizer) { + LOGGER.debug("Configure component {}, with customizer {}", + component, customizer); + customizer.customize(component); + } } } return component;