You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2017/05/22 12:03:44 UTC
[06/21] camel git commit: camel-spring-boot: improve customizer
configuration
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-printer-starter/src/main/java/org/apache/camel/component/printer/springboot/PrinterComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-printer-starter/src/main/java/org/apache/camel/component/printer/springboot/PrinterComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-printer-starter/src/main/java/org/apache/camel/component/printer/springboot/PrinterComponentAutoConfiguration.java
index b2515e7..a5c913d 100644
--- a/platforms/spring-boot/components-starter/camel-printer-starter/src/main/java/org/apache/camel/component/printer/springboot/PrinterComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-printer-starter/src/main/java/org/apache/camel/component/printer/springboot/PrinterComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.printer.PrinterComponent;
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 PrinterComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(PrinterComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private PrinterComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<PrinterComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private PrinterComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class PrinterComponentAutoConfiguration {
PrinterComponent component = new PrinterComponent();
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 PrinterComponentAutoConfiguration {
}
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<PrinterComponent> 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.lpr.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.lpr.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-protobuf-starter/src/main/java/org/apache/camel/dataformat/protobuf/springboot/ProtobufDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-protobuf-starter/src/main/java/org/apache/camel/dataformat/protobuf/springboot/ProtobufDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-protobuf-starter/src/main/java/org/apache/camel/dataformat/protobuf/springboot/ProtobufDataFormatAutoConfiguration.java
index 556c2da..400c88b 100644
--- a/platforms/spring-boot/components-starter/camel-protobuf-starter/src/main/java/org/apache/camel/dataformat/protobuf/springboot/ProtobufDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-protobuf-starter/src/main/java/org/apache/camel/dataformat/protobuf/springboot/ProtobufDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.protobuf.ProtobufDataFormat;
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 ProtobufDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ProtobufDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ProtobufDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<ProtobufDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private ProtobufDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class ProtobufDataFormatAutoConfiguration {
}
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 ProtobufDataFormatAutoConfiguration {
} 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<ProtobufDataFormat> 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.protobuf.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.protobuf.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-pubnub-starter/src/main/java/org/apache/camel/component/pubnub/springboot/PubNubComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/java/org/apache/camel/component/pubnub/springboot/PubNubComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/java/org/apache/camel/component/pubnub/springboot/PubNubComponentAutoConfiguration.java
index 170fb4c..1c0343e 100644
--- a/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/java/org/apache/camel/component/pubnub/springboot/PubNubComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-pubnub-starter/src/main/java/org/apache/camel/component/pubnub/springboot/PubNubComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.pubnub.PubNubComponent;
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 PubNubComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(PubNubComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private PubNubComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<PubNubComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private PubNubComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class PubNubComponentAutoConfiguration {
PubNubComponent component = new PubNubComponent();
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 PubNubComponentAutoConfiguration {
}
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<PubNubComponent> 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.pubnub.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.pubnub.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-quartz2-starter/src/main/java/org/apache/camel/component/quartz2/springboot/QuartzComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-quartz2-starter/src/main/java/org/apache/camel/component/quartz2/springboot/QuartzComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-quartz2-starter/src/main/java/org/apache/camel/component/quartz2/springboot/QuartzComponentAutoConfiguration.java
index 002c32f..cb576bd 100644
--- a/platforms/spring-boot/components-starter/camel-quartz2-starter/src/main/java/org/apache/camel/component/quartz2/springboot/QuartzComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-quartz2-starter/src/main/java/org/apache/camel/component/quartz2/springboot/QuartzComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.quartz2.QuartzComponent;
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 QuartzComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(QuartzComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private QuartzComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<QuartzComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private QuartzComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class QuartzComponentAutoConfiguration {
QuartzComponent component = new QuartzComponent();
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 QuartzComponentAutoConfiguration {
}
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<QuartzComponent> 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.quartz2.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.quartz2.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-quickfix-starter/src/main/java/org/apache/camel/component/quickfixj/springboot/QuickfixjComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-quickfix-starter/src/main/java/org/apache/camel/component/quickfixj/springboot/QuickfixjComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-quickfix-starter/src/main/java/org/apache/camel/component/quickfixj/springboot/QuickfixjComponentAutoConfiguration.java
index 7ac32d2..4a147c6 100644
--- a/platforms/spring-boot/components-starter/camel-quickfix-starter/src/main/java/org/apache/camel/component/quickfixj/springboot/QuickfixjComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-quickfix-starter/src/main/java/org/apache/camel/component/quickfixj/springboot/QuickfixjComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.quickfixj.QuickfixjComponent;
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 QuickfixjComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(QuickfixjComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private QuickfixjComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<QuickfixjComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private QuickfixjComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class QuickfixjComponentAutoConfiguration {
QuickfixjComponent component = new QuickfixjComponent();
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 QuickfixjComponentAutoConfiguration {
}
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<QuickfixjComponent> 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.quickfix.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.quickfix.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-rabbitmq-starter/src/main/java/org/apache/camel/component/rabbitmq/springboot/RabbitMQComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-rabbitmq-starter/src/main/java/org/apache/camel/component/rabbitmq/springboot/RabbitMQComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-rabbitmq-starter/src/main/java/org/apache/camel/component/rabbitmq/springboot/RabbitMQComponentAutoConfiguration.java
index fbce0c6..346b6af 100644
--- a/platforms/spring-boot/components-starter/camel-rabbitmq-starter/src/main/java/org/apache/camel/component/rabbitmq/springboot/RabbitMQComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-rabbitmq-starter/src/main/java/org/apache/camel/component/rabbitmq/springboot/RabbitMQComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.rabbitmq.RabbitMQComponent;
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 RabbitMQComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(RabbitMQComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private RabbitMQComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<RabbitMQComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private RabbitMQComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class RabbitMQComponentAutoConfiguration {
RabbitMQComponent component = new RabbitMQComponent();
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 RabbitMQComponentAutoConfiguration {
}
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<RabbitMQComponent> 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.rabbitmq.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.rabbitmq.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-reactive-streams-starter/src/main/java/org/apache/camel/component/reactive/streams/springboot/ReactiveStreamsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-reactive-streams-starter/src/main/java/org/apache/camel/component/reactive/streams/springboot/ReactiveStreamsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-reactive-streams-starter/src/main/java/org/apache/camel/component/reactive/streams/springboot/ReactiveStreamsComponentAutoConfiguration.java
index d2bd579..72c3a34 100644
--- a/platforms/spring-boot/components-starter/camel-reactive-streams-starter/src/main/java/org/apache/camel/component/reactive/streams/springboot/ReactiveStreamsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-reactive-streams-starter/src/main/java/org/apache/camel/component/reactive/streams/springboot/ReactiveStreamsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.reactive.streams.ReactiveStreamsComponent;
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 ReactiveStreamsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ReactiveStreamsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ReactiveStreamsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ReactiveStreamsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ReactiveStreamsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class ReactiveStreamsComponentAutoConfiguration {
ReactiveStreamsComponent component = new ReactiveStreamsComponent();
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 ReactiveStreamsComponentAutoConfiguration {
}
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<ReactiveStreamsComponent> 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.reactive-streams.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.reactive-streams.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-rest-swagger-starter/src/main/java/org/apache/camel/component/rest/swagger/springboot/RestSwaggerComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-rest-swagger-starter/src/main/java/org/apache/camel/component/rest/swagger/springboot/RestSwaggerComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-rest-swagger-starter/src/main/java/org/apache/camel/component/rest/swagger/springboot/RestSwaggerComponentAutoConfiguration.java
index cd77f0c..38547ac 100644
--- a/platforms/spring-boot/components-starter/camel-rest-swagger-starter/src/main/java/org/apache/camel/component/rest/swagger/springboot/RestSwaggerComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-rest-swagger-starter/src/main/java/org/apache/camel/component/rest/swagger/springboot/RestSwaggerComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.rest.swagger.RestSwaggerComponent;
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 RestSwaggerComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(RestSwaggerComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private RestSwaggerComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<RestSwaggerComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private RestSwaggerComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class RestSwaggerComponentAutoConfiguration {
RestSwaggerComponent component = new RestSwaggerComponent();
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 RestSwaggerComponentAutoConfiguration {
}
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<RestSwaggerComponent> 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.rest-swagger.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.rest-swagger.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-restlet-starter/src/main/java/org/apache/camel/component/restlet/springboot/RestletComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-restlet-starter/src/main/java/org/apache/camel/component/restlet/springboot/RestletComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-restlet-starter/src/main/java/org/apache/camel/component/restlet/springboot/RestletComponentAutoConfiguration.java
index 6f6df84..aaa2a9a 100644
--- a/platforms/spring-boot/components-starter/camel-restlet-starter/src/main/java/org/apache/camel/component/restlet/springboot/RestletComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-restlet-starter/src/main/java/org/apache/camel/component/restlet/springboot/RestletComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.restlet.RestletComponent;
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 RestletComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(RestletComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private RestletComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<RestletComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private RestletComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class RestletComponentAutoConfiguration {
RestletComponent component = new RestletComponent();
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 RestletComponentAutoConfiguration {
}
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<RestletComponent> 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.restlet.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.restlet.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-rmi-starter/src/main/java/org/apache/camel/component/rmi/springboot/RmiComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-rmi-starter/src/main/java/org/apache/camel/component/rmi/springboot/RmiComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-rmi-starter/src/main/java/org/apache/camel/component/rmi/springboot/RmiComponentAutoConfiguration.java
index 2e2d8f0..a1102d8 100644
--- a/platforms/spring-boot/components-starter/camel-rmi-starter/src/main/java/org/apache/camel/component/rmi/springboot/RmiComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-rmi-starter/src/main/java/org/apache/camel/component/rmi/springboot/RmiComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.rmi.RmiComponent;
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 RmiComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(RmiComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private RmiComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<RmiComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private RmiComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class RmiComponentAutoConfiguration {
RmiComponent component = new RmiComponent();
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 RmiComponentAutoConfiguration {
}
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<RmiComponent> 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.rmi.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.rmi.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-routebox-starter/src/main/java/org/apache/camel/component/routebox/springboot/RouteboxComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-routebox-starter/src/main/java/org/apache/camel/component/routebox/springboot/RouteboxComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-routebox-starter/src/main/java/org/apache/camel/component/routebox/springboot/RouteboxComponentAutoConfiguration.java
index 485e275..7de4389 100644
--- a/platforms/spring-boot/components-starter/camel-routebox-starter/src/main/java/org/apache/camel/component/routebox/springboot/RouteboxComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-routebox-starter/src/main/java/org/apache/camel/component/routebox/springboot/RouteboxComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.routebox.RouteboxComponent;
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 RouteboxComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(RouteboxComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private RouteboxComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<RouteboxComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private RouteboxComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class RouteboxComponentAutoConfiguration {
RouteboxComponent component = new RouteboxComponent();
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 RouteboxComponentAutoConfiguration {
}
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<RouteboxComponent> 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.routebox.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.routebox.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-rss-starter/src/main/java/org/apache/camel/component/rss/springboot/RssComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-rss-starter/src/main/java/org/apache/camel/component/rss/springboot/RssComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-rss-starter/src/main/java/org/apache/camel/component/rss/springboot/RssComponentAutoConfiguration.java
index 68b78e5..f4abda4 100644
--- a/platforms/spring-boot/components-starter/camel-rss-starter/src/main/java/org/apache/camel/component/rss/springboot/RssComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-rss-starter/src/main/java/org/apache/camel/component/rss/springboot/RssComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.rss.RssComponent;
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 RssComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(RssComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private RssComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<RssComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private RssComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class RssComponentAutoConfiguration {
RssComponent component = new RssComponent();
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 RssComponentAutoConfiguration {
}
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<RssComponent> 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.rss.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.rss.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-rss-starter/src/main/java/org/apache/camel/dataformat/rss/springboot/RssDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-rss-starter/src/main/java/org/apache/camel/dataformat/rss/springboot/RssDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-rss-starter/src/main/java/org/apache/camel/dataformat/rss/springboot/RssDataFormatAutoConfiguration.java
index faa4347..5b4cb8e 100644
--- a/platforms/spring-boot/components-starter/camel-rss-starter/src/main/java/org/apache/camel/dataformat/rss/springboot/RssDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-rss-starter/src/main/java/org/apache/camel/dataformat/rss/springboot/RssDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.rss.RssDataFormat;
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 RssDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(RssDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private RssDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<RssDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private RssDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class RssDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -98,15 +101,24 @@ public class RssDataFormatAutoConfiguration {
} 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<RssDataFormat> 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.rss.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.rss.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-salesforce-starter/src/main/java/org/apache/camel/component/salesforce/springboot/SalesforceComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-salesforce-starter/src/main/java/org/apache/camel/component/salesforce/springboot/SalesforceComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-salesforce-starter/src/main/java/org/apache/camel/component/salesforce/springboot/SalesforceComponentAutoConfiguration.java
index 0f69a4c..edc09c5 100644
--- a/platforms/spring-boot/components-starter/camel-salesforce-starter/src/main/java/org/apache/camel/component/salesforce/springboot/SalesforceComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-salesforce-starter/src/main/java/org/apache/camel/component/salesforce/springboot/SalesforceComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.salesforce.SalesforceComponent;
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 SalesforceComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SalesforceComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SalesforceComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SalesforceComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SalesforceComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SalesforceComponentAutoConfiguration {
SalesforceComponent component = new SalesforceComponent();
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 SalesforceComponentAutoConfiguration {
}
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<SalesforceComponent> 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.salesforce.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.salesforce.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-sap-netweaver-starter/src/main/java/org/apache/camel/component/sap/netweaver/springboot/NetWeaverComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-sap-netweaver-starter/src/main/java/org/apache/camel/component/sap/netweaver/springboot/NetWeaverComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-sap-netweaver-starter/src/main/java/org/apache/camel/component/sap/netweaver/springboot/NetWeaverComponentAutoConfiguration.java
index ab4e685..c17d318 100644
--- a/platforms/spring-boot/components-starter/camel-sap-netweaver-starter/src/main/java/org/apache/camel/component/sap/netweaver/springboot/NetWeaverComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-sap-netweaver-starter/src/main/java/org/apache/camel/component/sap/netweaver/springboot/NetWeaverComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.sap.netweaver.NetWeaverComponent;
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 NetWeaverComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(NetWeaverComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private NetWeaverComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<NetWeaverComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private NetWeaverComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class NetWeaverComponentAutoConfiguration {
NetWeaverComponent component = new NetWeaverComponent();
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 NetWeaverComponentAutoConfiguration {
}
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<NetWeaverComponent> 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.sap-netweaver.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.sap-netweaver.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-saxon-starter/src/main/java/org/apache/camel/component/xquery/springboot/XQueryComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-saxon-starter/src/main/java/org/apache/camel/component/xquery/springboot/XQueryComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-saxon-starter/src/main/java/org/apache/camel/component/xquery/springboot/XQueryComponentAutoConfiguration.java
index 0d3b3ce..f7e1f16 100644
--- a/platforms/spring-boot/components-starter/camel-saxon-starter/src/main/java/org/apache/camel/component/xquery/springboot/XQueryComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-saxon-starter/src/main/java/org/apache/camel/component/xquery/springboot/XQueryComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.xquery.XQueryComponent;
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 XQueryComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(XQueryComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private XQueryComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<XQueryComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private XQueryComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class XQueryComponentAutoConfiguration {
XQueryComponent component = new XQueryComponent();
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 XQueryComponentAutoConfiguration {
}
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<XQueryComponent> 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.xquery.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.xquery.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;