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:39 UTC
[01/21] camel git commit: camel-spring-boot: improve customizer
configuration
Repository: camel
Updated Branches:
refs/heads/master ed85770f3 -> 1ca7a4260
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
index 50c3b61..7230dfe 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
@@ -82,6 +82,7 @@ import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
@@ -1174,18 +1175,15 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
private void createComponentAutoConfigurationSource(
String packageName, ComponentModel model, List<String> componentAliases, String overrideComponentName) throws MojoFailureException {
- final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
-
- int pos = model.getJavaType().lastIndexOf(".");
- String name = model.getJavaType().substring(pos + 1);
- name = name.replace("Component", "ComponentAutoConfiguration");
-
- String configurationName = name.replace("ComponentAutoConfiguration", "ComponentConfiguration");
+ final String name = model.getJavaType().substring(model.getJavaType().lastIndexOf(".") + 1).replace("Component", "ComponentAutoConfiguration");
+ final String configurationName = name.replace("ComponentAutoConfiguration", "ComponentConfiguration");
+ final String componentName = (overrideComponentName != null ? overrideComponentName : model.getScheme()).toLowerCase(Locale.US);
- javaClass.setPackage(packageName).setName(name);
+ final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
- String doc = "Generated by camel-package-maven-plugin - do not edit this file!";
- javaClass.getJavaDoc().setFullText(doc);
+ javaClass.setPackage(packageName);
+ javaClass.setName(name);
+ javaClass.getJavaDoc().setFullText("Generated by camel-package-maven-plugin - do not edit this file!");
javaClass.addAnnotation(Generated.class).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName());
javaClass.addAnnotation(Configuration.class);
javaClass.addAnnotation(Conditional.class).setLiteralValue(
@@ -1196,10 +1194,9 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
);
javaClass.addImport(HashMap.class);
- javaClass.addImport(Map.class);
- javaClass.addImport("org.apache.camel.util.IntrospectionSupport");
- javaClass.addImport(model.getJavaType());
javaClass.addImport(List.class);
+ javaClass.addImport(Map.class);
+ javaClass.addImport(ApplicationContext.class);
javaClass.addImport(ConditionalOnBean.class);
javaClass.addImport("org.slf4j.Logger");
javaClass.addImport("org.slf4j.LoggerFactory");
@@ -1209,7 +1206,11 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
javaClass.addImport("org.apache.camel.spring.boot.ComponentConfigurationProperties");
javaClass.addImport("org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans");
javaClass.addImport("org.apache.camel.spring.boot.util.GroupCondition");
+ javaClass.addImport("org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator");
+ javaClass.addImport("org.apache.camel.util.IntrospectionSupport");
javaClass.addImport("org.apache.camel.util.ObjectHelper");
+ javaClass.addImport("org.apache.camel.spi.HasId");
+ javaClass.addImport(model.getJavaType());
javaClass.addField()
.setPrivate()
@@ -1218,30 +1219,27 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
.setName("LOGGER")
.setType("Logger")
.setLiteralInitializer("LoggerFactory.getLogger(" + name + ".class)");
-
javaClass.addField()
.setPrivate()
- .setName("camelContext")
- .setType("CamelContext")
+ .setName("applicationContext")
+ .setType("ApplicationContext")
.addAnnotation(Autowired.class);
-
javaClass.addField()
.setPrivate()
- .setName("customizers")
- .setType("List<ComponentCustomizer<" + model.getShortJavaType() + ">>")
- .addAnnotation(Autowired.class).setLiteralValue("required", "false");
-
- javaClass.addField()
- .setPrivate()
- .setName("globalConfiguration")
- .setType("ComponentConfigurationProperties")
+ .setName("camelContext")
+ .setType("CamelContext")
.addAnnotation(Autowired.class);
-
javaClass.addField()
.setPrivate()
- .setName("componentConfiguration")
+ .setName("configuration")
.setType(configurationName)
.addAnnotation(Autowired.class);
+ javaClass.addField()
+ .setPrivate()
+ .setName("customizers")
+ .setType("List<ComponentCustomizer<" + model.getShortJavaType() + ">>")
+ .addAnnotation(Autowired.class)
+ .setLiteralValue("required", "false");
javaClass.addNestedType(
Roaster.create(JavaClassSource.class)
@@ -1253,12 +1251,12 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
.setName("GroupConditions")
.setConstructor(true)
.setPublic()
- .setBody("super(\"camel.component\", \"camel.component." + (overrideComponentName != null ? overrideComponentName : model.getScheme()).toLowerCase(Locale.US) + "\");")
+ .setBody("super(\"camel.component\", \"camel.component." + componentName + "\");")
.getOrigin()
);
// add method for auto configure
- String body = createComponentBody(model.getShortJavaType());
+ String body = createComponentBody(model.getShortJavaType(), componentName);
String methodName = "configure" + model.getShortJavaType();
MethodSource<JavaClassSource> method = javaClass.addMethod()
@@ -1284,17 +1282,15 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
private void createDataFormatAutoConfigurationSource(
String packageName, DataFormatModel model, List<String> dataFormatAliases, String overrideDataFormatName) throws MojoFailureException {
- final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
+ final String name = model.getJavaType().substring(model.getJavaType().lastIndexOf(".") + 1).replace("DataFormat", "DataFormatAutoConfiguration");
+ final String configurationName = name.replace("DataFormatAutoConfiguration", "DataFormatConfiguration");
+ final String dataformatName = (overrideDataFormatName != null ? overrideDataFormatName : model.getName()).toLowerCase(Locale.US);
- int pos = model.getJavaType().lastIndexOf(".");
- String name = model.getJavaType().substring(pos + 1);
- name = name.replace("DataFormat", "DataFormatAutoConfiguration");
-
- String configurationName = name.replace("DataFormatAutoConfiguration", "DataFormatConfiguration");
- javaClass.setPackage(packageName).setName(name);
+ final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
- String doc = "Generated by camel-package-maven-plugin - do not edit this file!";
- javaClass.getJavaDoc().setFullText(doc);
+ javaClass.setPackage(packageName);
+ javaClass.setName(name);
+ javaClass.getJavaDoc().setFullText("Generated by camel-package-maven-plugin - do not edit this file!");
javaClass.addAnnotation(Generated.class).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName());
javaClass.addAnnotation(Configuration.class);
javaClass.addAnnotation(Conditional.class).setLiteralValue(
@@ -1305,10 +1301,9 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
);
javaClass.addImport(HashMap.class);
- javaClass.addImport(Map.class);
- javaClass.addImport("org.apache.camel.util.IntrospectionSupport");
- javaClass.addImport(model.getJavaType());
javaClass.addImport(List.class);
+ javaClass.addImport(Map.class);
+ javaClass.addImport(ApplicationContext.class);
javaClass.addImport(ConditionalOnBean.class);
javaClass.addImport("org.slf4j.Logger");
javaClass.addImport("org.slf4j.LoggerFactory");
@@ -1318,11 +1313,15 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
javaClass.addImport("org.apache.camel.spring.boot.DataFormatConfigurationProperties");
javaClass.addImport("org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans");
javaClass.addImport("org.apache.camel.spring.boot.util.GroupCondition");
+ javaClass.addImport("org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator");
+ javaClass.addImport("org.apache.camel.util.IntrospectionSupport");
javaClass.addImport("org.apache.camel.util.ObjectHelper");
javaClass.addImport("org.apache.camel.RuntimeCamelException");
javaClass.addImport("org.apache.camel.spi.DataFormat");
javaClass.addImport("org.apache.camel.spi.DataFormatCustomizer");
javaClass.addImport("org.apache.camel.spi.DataFormatFactory");
+ javaClass.addImport("org.apache.camel.spi.HasId");
+ javaClass.addImport(model.getJavaType());
javaClass.addField()
.setPrivate()
@@ -1331,13 +1330,21 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
.setName("LOGGER")
.setType("Logger")
.setLiteralInitializer("LoggerFactory.getLogger(" + name + ".class)");
-
+ javaClass.addField()
+ .setPrivate()
+ .setName("applicationContext")
+ .setType("ApplicationContext")
+ .addAnnotation(Autowired.class);
javaClass.addField()
.setPrivate()
.setName("camelContext")
.setType("CamelContext")
.addAnnotation(Autowired.class);
-
+ javaClass.addField()
+ .setPrivate()
+ .setName("configuration")
+ .setType(configurationName)
+ .addAnnotation(Autowired.class);
javaClass.addField()
.setPrivate()
.setName("customizers")
@@ -1345,18 +1352,6 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
.addAnnotation(Autowired.class)
.setLiteralValue("required", "false");
- javaClass.addField()
- .setPrivate()
- .setName("globalConfiguration")
- .setType("DataFormatConfigurationProperties")
- .addAnnotation(Autowired.class);
-
- javaClass.addField()
- .setPrivate()
- .setName("dataformatConfiguration")
- .setType(configurationName)
- .addAnnotation(Autowired.class);
-
javaClass.addNestedType(
Roaster.create(JavaClassSource.class)
.setName("GroupConditions")
@@ -1367,12 +1362,12 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
.setName("GroupConditions")
.setConstructor(true)
.setPublic()
- .setBody("super(\"camel.dataformat\", \"camel.dataformat." + (overrideDataFormatName != null ? overrideDataFormatName : model.getName()).toLowerCase(Locale.US) + "\");")
+ .setBody("super(\"camel.dataformat\", \"camel.dataformat." + dataformatName + "\");")
.getOrigin()
);
- String body = createDataFormatBody(model.getShortJavaType());
+ String body = createDataFormatBody(model.getShortJavaType(), dataformatName);
String methodName = "configure" + model.getShortJavaType() + "Factory";
MethodSource<JavaClassSource> method = javaClass.addMethod()
@@ -1398,18 +1393,15 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
private void createLanguageAutoConfigurationSource(
String packageName, LanguageModel model, List<String> languageAliases, String overrideLanguageName) throws MojoFailureException {
- final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
-
- int pos = model.getJavaType().lastIndexOf(".");
- String name = model.getJavaType().substring(pos + 1);
- name = name.replace("Language", "LanguageAutoConfiguration");
-
- String configurationName = name.replace("LanguageAutoConfiguration", "LanguageConfiguration");
+ final String name = model.getJavaType().substring(model.getJavaType().lastIndexOf(".") + 1).replace("Language", "LanguageAutoConfiguration");
+ final String configurationName = name.replace("LanguageAutoConfiguration", "LanguageConfiguration");
+ final String languageName = (overrideLanguageName != null ? overrideLanguageName : model.getName()).toLowerCase(Locale.US);
- javaClass.setPackage(packageName).setName(name);
+ final JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
- String doc = "Generated by camel-package-maven-plugin - do not edit this file!";
- javaClass.getJavaDoc().setFullText(doc);
+ javaClass.setPackage(packageName);
+ javaClass.setName(name);
+ javaClass.getJavaDoc().setFullText("Generated by camel-package-maven-plugin - do not edit this file!");
javaClass.addAnnotation(Generated.class).setStringValue("value", SpringBootAutoConfigurationMojo.class.getName());
javaClass.addAnnotation(Configuration.class);
javaClass.addAnnotation(Conditional.class).setLiteralValue(
@@ -1418,12 +1410,11 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
javaClass.addAnnotation(EnableConfigurationProperties.class).setLiteralValue(
"{ LanguageConfigurationProperties.class, " + configurationName + ".class }"
);
- javaClass.addImport(HashMap.class);
- javaClass.addImport(Map.class);
- javaClass.addImport("org.apache.camel.util.IntrospectionSupport");
- javaClass.addImport(model.getJavaType());
+ javaClass.addImport(HashMap.class);
javaClass.addImport(List.class);
+ javaClass.addImport(Map.class);
+ javaClass.addImport(ApplicationContext.class);
javaClass.addImport(ConditionalOnBean.class);
javaClass.addImport(ConfigurableBeanFactory.class);
javaClass.addImport("org.slf4j.Logger");
@@ -1434,8 +1425,12 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
javaClass.addImport("org.apache.camel.spring.boot.LanguageConfigurationProperties");
javaClass.addImport("org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans");
javaClass.addImport("org.apache.camel.spring.boot.util.GroupCondition");
+ javaClass.addImport("org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator");
+ javaClass.addImport("org.apache.camel.util.IntrospectionSupport");
javaClass.addImport("org.apache.camel.util.ObjectHelper");
+ javaClass.addImport("org.apache.camel.spi.HasId");
javaClass.addImport("org.apache.camel.spi.LanguageCustomizer");
+ javaClass.addImport(model.getJavaType());
javaClass.addField()
.setPrivate()
@@ -1444,30 +1439,27 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
.setName("LOGGER")
.setType("Logger")
.setLiteralInitializer("LoggerFactory.getLogger(" + name + ".class)");
-
javaClass.addField()
.setPrivate()
- .setName("camelContext")
- .setType("CamelContext")
+ .setName("applicationContext")
+ .setType("ApplicationContext")
.addAnnotation(Autowired.class);
-
- javaClass.addField()
- .setPrivate()
- .setName("customizers")
- .setType("List<LanguageCustomizer<" + model.getShortJavaType() + ">>")
- .addAnnotation(Autowired.class).setLiteralValue("required", "false");
-
javaClass.addField()
.setPrivate()
- .setName("globalConfiguration")
- .setType("LanguageConfigurationProperties")
+ .setName("camelContext")
+ .setType("CamelContext")
.addAnnotation(Autowired.class);
-
javaClass.addField()
.setPrivate()
- .setName("languageConfiguration")
+ .setName("configuration")
.setType(configurationName)
.addAnnotation(Autowired.class);
+ javaClass.addField()
+ .setPrivate()
+ .setName("customizers")
+ .setType("List<LanguageCustomizer<" + model.getShortJavaType() + ">>")
+ .addAnnotation(Autowired.class)
+ .setLiteralValue("required", "false");
javaClass.addNestedType(
Roaster.create(JavaClassSource.class)
@@ -1479,11 +1471,11 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
.setName("GroupConditions")
.setConstructor(true)
.setPublic()
- .setBody("super(\"camel.component\", \"camel.component." + (overrideLanguageName != null ? overrideLanguageName : model.getName()).toLowerCase(Locale.US) + "\");")
+ .setBody("super(\"camel.component\", \"camel.component." + languageName + "\");")
.getOrigin()
);
- String body = createLanguageBody(model.getShortJavaType());
+ String body = createLanguageBody(model.getShortJavaType(), languageName);
String methodName = "configure" + model.getShortJavaType();
MethodSource<JavaClassSource> method = javaClass.addMethod()
@@ -1531,13 +1523,13 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
writeComponentSpringFactorySource(packageName, name);
}
- private static String createComponentBody(String shortJavaType) {
+ private static String createComponentBody(String shortJavaType, String name) {
StringBuilder sb = new StringBuilder();
sb.append(shortJavaType).append(" component = new ").append(shortJavaType).append("();").append("\n");
sb.append("component.setCamelContext(camelContext);\n");
sb.append("\n");
sb.append("Map<String, Object> parameters = new HashMap<>();\n");
- sb.append("IntrospectionSupport.getProperties(componentConfiguration, parameters, null, false);\n");
+ sb.append("IntrospectionSupport.getProperties(configuration, parameters, null, false);\n");
sb.append("\n");
sb.append("for (Map.Entry<String, Object> entry : parameters.entrySet()) {\n");
sb.append(" Object value = entry.getValue();\n");
@@ -1558,12 +1550,24 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
sb.append("}\n");
sb.append("IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), component, parameters);\n");
sb.append("\n");
- sb.append("boolean useCustomizers = globalConfiguration.getCustomizer().isEnabled() && componentConfiguration.getCustomizer().isEnabled();\n");
- sb.append("\n");
- sb.append("if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {\n");
+ sb.append("if (ObjectHelper.isNotEmpty(customizers)) {\n");
sb.append(" for (ComponentCustomizer<").append(shortJavaType).append("> customizer : customizers) {\n");
- sb.append(" LOGGER.debug(\"Configure component {}, with customizer {}\", component, customizer);\n");
- sb.append(" customizer.customize(component);\n");
+ sb.append("\n");
+ sb.append(" boolean useCustomizer = (customizer instanceof HasId)");
+ sb.append(" ? HierarchicalPropertiesEvaluator.evaluate(\n");
+ sb.append(" applicationContext.getEnvironment(),\n");
+ sb.append(" \"camel.component.customizer\",\n");
+ sb.append(" \"camel.component.").append(name).append(".customizer\",\n");
+ sb.append(" ((HasId)customizer).getId())\n");
+ sb.append(" : HierarchicalPropertiesEvaluator.evaluate(\n");
+ sb.append(" applicationContext.getEnvironment(),\n");
+ sb.append(" \"camel.component.customizer\",\n");
+ sb.append(" \"camel.component.").append(name).append(".customizer\");\n");
+ sb.append("\n");
+ sb.append(" if (useCustomizer) {\n");
+ sb.append(" LOGGER.debug(\"Configure component {}, with customizer {}\", component, customizer);\n");
+ sb.append(" customizer.customize(component);\n");
+ sb.append(" }\n");
sb.append(" }\n");
sb.append("}\n");
sb.append("\n");
@@ -1572,7 +1576,7 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
return sb.toString();
}
- private static String createDataFormatBody(String shortJavaType) {
+ private static String createDataFormatBody(String shortJavaType, String name) {
StringBuilder sb = new StringBuilder();
sb.append("return new DataFormatFactory() {\n");
sb.append(" @Override\n");
@@ -1587,28 +1591,41 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
sb.append("\n");
sb.append(" try {\n");
sb.append(" Map<String, Object> parameters = new HashMap<>();\n");
- sb.append(" IntrospectionSupport.getProperties(dataformatConfiguration, parameters, null, false);\n");
+ sb.append(" IntrospectionSupport.getProperties(configuration, parameters, null, false);\n");
sb.append(" IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), dataformat, parameters);\n");
sb.append(" } catch (Exception e) {\n");
sb.append(" throw new RuntimeCamelException(e);\n");
sb.append(" }\n");
sb.append("\n");
- sb.append("boolean useCustomizers = globalConfiguration.getCustomizer().isEnabled() && dataformatConfiguration.getCustomizer().isEnabled();\n");
- sb.append("\n");
- sb.append("if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {\n");
+ sb.append("if (ObjectHelper.isNotEmpty(customizers)) {\n");
sb.append(" for (DataFormatCustomizer<").append(shortJavaType).append("> customizer : customizers) {\n");
- sb.append(" LOGGER.debug(\"Configure dataformat {}, with customizer {}\", dataformat, customizer);\n");
- sb.append(" customizer.customize(dataformat);\n");
+ sb.append("\n");
+ sb.append(" boolean useCustomizer = (customizer instanceof HasId)");
+ sb.append(" ? HierarchicalPropertiesEvaluator.evaluate(\n");
+ sb.append(" applicationContext.getEnvironment(),\n");
+ sb.append(" \"camel.dataformat.customizer\",\n");
+ sb.append(" \"camel.dataformat.").append(name).append(".customizer\",\n");
+ sb.append(" ((HasId)customizer).getId())\n");
+ sb.append(" : HierarchicalPropertiesEvaluator.evaluate(\n");
+ sb.append(" applicationContext.getEnvironment(),\n");
+ sb.append(" \"camel.dataformat.customizer\",\n");
+ sb.append(" \"camel.dataformat.").append(name).append(".customizer\");\n");
+ sb.append("\n");
+ sb.append(" if (useCustomizer) {\n");
+ sb.append(" LOGGER.debug(\"Configure dataformat {}, with customizer {}\", dataformat, customizer);\n");
+ sb.append(" customizer.customize(dataformat);\n");
+ sb.append(" }\n");
sb.append(" }\n");
sb.append("}\n");
sb.append("\n");
sb.append(" return dataformat;\n");
sb.append(" }\n");
sb.append("};\n");
+
return sb.toString();
}
- private static String createLanguageBody(String shortJavaType) {
+ private static String createLanguageBody(String shortJavaType, String name) {
StringBuilder sb = new StringBuilder();
sb.append(shortJavaType).append(" language = new ").append(shortJavaType).append("();").append("\n");
sb.append("if (CamelContextAware.class.isAssignableFrom(").append(shortJavaType).append(".class)) {\n");
@@ -1619,19 +1636,33 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
sb.append("}\n");
sb.append("\n");
sb.append("Map<String, Object> parameters = new HashMap<>();\n");
- sb.append("IntrospectionSupport.getProperties(languageConfiguration, parameters, null, false);\n");
+ sb.append("IntrospectionSupport.getProperties(configuration, parameters, null, false);\n");
sb.append("IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), language, parameters);\n");
sb.append("\n");
- sb.append("boolean useCustomizers = globalConfiguration.getCustomizer().isEnabled() && languageConfiguration.getCustomizer().isEnabled();\n");
sb.append("\n");
- sb.append("if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {\n");
+ sb.append("if (ObjectHelper.isNotEmpty(customizers)) {\n");
sb.append(" for (LanguageCustomizer<").append(shortJavaType).append("> customizer : customizers) {\n");
- sb.append(" LOGGER.debug(\"Configure language {}, with customizer {}\", language, customizer);\n");
- sb.append(" customizer.customize(language);\n");
+ sb.append("\n");
+ sb.append(" boolean useCustomizer = (customizer instanceof HasId)");
+ sb.append(" ? HierarchicalPropertiesEvaluator.evaluate(\n");
+ sb.append(" applicationContext.getEnvironment(),\n");
+ sb.append(" \"camel.language.customizer\",\n");
+ sb.append(" \"camel.language.").append(name).append(".customizer\",\n");
+ sb.append(" ((HasId)customizer).getId())\n");
+ sb.append(" : HierarchicalPropertiesEvaluator.evaluate(\n");
+ sb.append(" applicationContext.getEnvironment(),\n");
+ sb.append(" \"camel.language.customizer\",\n");
+ sb.append(" \"camel.language.").append(name).append(".customizer\");\n");
+ sb.append("\n");
+ sb.append(" if (useCustomizer) {\n");
+ sb.append(" LOGGER.debug(\"Configure language {}, with customizer {}\", language, customizer);\n");
+ sb.append(" customizer.customize(language);\n");
+ sb.append(" }\n");
sb.append(" }\n");
sb.append("}\n");
sb.append("\n");
sb.append("return language;");
+
return sb.toString();
}
[08/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
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;
[09/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-jt400-starter/src/main/java/org/apache/camel/component/jt400/springboot/Jt400ComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jt400-starter/src/main/java/org/apache/camel/component/jt400/springboot/Jt400ComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jt400-starter/src/main/java/org/apache/camel/component/jt400/springboot/Jt400ComponentAutoConfiguration.java
index 8a889eb..2718d20 100644
--- a/platforms/spring-boot/components-starter/camel-jt400-starter/src/main/java/org/apache/camel/component/jt400/springboot/Jt400ComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jt400-starter/src/main/java/org/apache/camel/component/jt400/springboot/Jt400ComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.jt400.Jt400Component;
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 Jt400ComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(Jt400ComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private Jt400ComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<Jt400Component>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private Jt400ComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class Jt400ComponentAutoConfiguration {
Jt400Component component = new Jt400Component();
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 Jt400ComponentAutoConfiguration {
}
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<Jt400Component> 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.jt400.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.jt400.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-juel-starter/src/main/java/org/apache/camel/language/juel/springboot/JuelLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-juel-starter/src/main/java/org/apache/camel/language/juel/springboot/JuelLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-juel-starter/src/main/java/org/apache/camel/language/juel/springboot/JuelLanguageAutoConfiguration.java
index c880a52..87fd05a 100644
--- a/platforms/spring-boot/components-starter/camel-juel-starter/src/main/java/org/apache/camel/language/juel/springboot/JuelLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-juel-starter/src/main/java/org/apache/camel/language/juel/springboot/JuelLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.juel.JuelLanguage;
+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 JuelLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JuelLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JuelLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<JuelLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private JuelLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class JuelLanguageAutoConfiguration {
}
}
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<JuelLanguage> 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.el.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.el.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-jxpath-starter/src/main/java/org/apache/camel/language/jxpath/springboot/JXPathLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jxpath-starter/src/main/java/org/apache/camel/language/jxpath/springboot/JXPathLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jxpath-starter/src/main/java/org/apache/camel/language/jxpath/springboot/JXPathLanguageAutoConfiguration.java
index 21573f61..a510a86 100644
--- a/platforms/spring-boot/components-starter/camel-jxpath-starter/src/main/java/org/apache/camel/language/jxpath/springboot/JXPathLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jxpath-starter/src/main/java/org/apache/camel/language/jxpath/springboot/JXPathLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.jxpath.JXPathLanguage;
+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 JXPathLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JXPathLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JXPathLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<JXPathLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private JXPathLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class JXPathLanguageAutoConfiguration {
}
}
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<JXPathLanguage> 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.jxpath.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.jxpath.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-kafka-starter/src/main/java/org/apache/camel/component/kafka/springboot/KafkaComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-kafka-starter/src/main/java/org/apache/camel/component/kafka/springboot/KafkaComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-kafka-starter/src/main/java/org/apache/camel/component/kafka/springboot/KafkaComponentAutoConfiguration.java
index adca1a5..93eb2b3 100644
--- a/platforms/spring-boot/components-starter/camel-kafka-starter/src/main/java/org/apache/camel/component/kafka/springboot/KafkaComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-kafka-starter/src/main/java/org/apache/camel/component/kafka/springboot/KafkaComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.kafka.KafkaComponent;
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 KafkaComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(KafkaComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private KafkaComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<KafkaComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private KafkaComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class KafkaComponentAutoConfiguration {
KafkaComponent component = new KafkaComponent();
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 KafkaComponentAutoConfiguration {
}
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<KafkaComponent> 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.kafka.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.kafka.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-kestrel-starter/src/main/java/org/apache/camel/component/kestrel/springboot/KestrelComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-kestrel-starter/src/main/java/org/apache/camel/component/kestrel/springboot/KestrelComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-kestrel-starter/src/main/java/org/apache/camel/component/kestrel/springboot/KestrelComponentAutoConfiguration.java
index 84112b2..c294a6e 100644
--- a/platforms/spring-boot/components-starter/camel-kestrel-starter/src/main/java/org/apache/camel/component/kestrel/springboot/KestrelComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-kestrel-starter/src/main/java/org/apache/camel/component/kestrel/springboot/KestrelComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.kestrel.KestrelComponent;
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 KestrelComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(KestrelComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private KestrelComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<KestrelComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private KestrelComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class KestrelComponentAutoConfiguration {
KestrelComponent component = new KestrelComponent();
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 KestrelComponentAutoConfiguration {
}
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<KestrelComponent> 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.kestrel.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.kestrel.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-krati-starter/src/main/java/org/apache/camel/component/krati/springboot/KratiComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-krati-starter/src/main/java/org/apache/camel/component/krati/springboot/KratiComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-krati-starter/src/main/java/org/apache/camel/component/krati/springboot/KratiComponentAutoConfiguration.java
index 703d8c7..930c4c0 100644
--- a/platforms/spring-boot/components-starter/camel-krati-starter/src/main/java/org/apache/camel/component/krati/springboot/KratiComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-krati-starter/src/main/java/org/apache/camel/component/krati/springboot/KratiComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.krati.KratiComponent;
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 KratiComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(KratiComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private KratiComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<KratiComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private KratiComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class KratiComponentAutoConfiguration {
KratiComponent component = new KratiComponent();
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 KratiComponentAutoConfiguration {
}
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<KratiComponent> 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.krati.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.krati.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-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/KubernetesComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/KubernetesComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/KubernetesComponentAutoConfiguration.java
index bb4bc62..eff2182 100644
--- a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/KubernetesComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/KubernetesComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.kubernetes.KubernetesComponent;
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 KubernetesComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(KubernetesComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private KubernetesComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<KubernetesComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private KubernetesComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class KubernetesComponentAutoConfiguration {
KubernetesComponent component = new KubernetesComponent();
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 KubernetesComponentAutoConfiguration {
}
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<KubernetesComponent> 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.kubernetes.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.kubernetes.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-ldap-starter/src/main/java/org/apache/camel/component/ldap/springboot/LdapComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ldap-starter/src/main/java/org/apache/camel/component/ldap/springboot/LdapComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ldap-starter/src/main/java/org/apache/camel/component/ldap/springboot/LdapComponentAutoConfiguration.java
index bdd813d..b1151e5 100644
--- a/platforms/spring-boot/components-starter/camel-ldap-starter/src/main/java/org/apache/camel/component/ldap/springboot/LdapComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ldap-starter/src/main/java/org/apache/camel/component/ldap/springboot/LdapComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ldap.LdapComponent;
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 LdapComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(LdapComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private LdapComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<LdapComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private LdapComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class LdapComponentAutoConfiguration {
LdapComponent component = new LdapComponent();
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 LdapComponentAutoConfiguration {
}
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<LdapComponent> 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.ldap.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ldap.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-linkedin-starter/src/main/java/org/apache/camel/component/linkedin/springboot/LinkedInComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-linkedin-starter/src/main/java/org/apache/camel/component/linkedin/springboot/LinkedInComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-linkedin-starter/src/main/java/org/apache/camel/component/linkedin/springboot/LinkedInComponentAutoConfiguration.java
index 8cf3aa3..03eed45 100644
--- a/platforms/spring-boot/components-starter/camel-linkedin-starter/src/main/java/org/apache/camel/component/linkedin/springboot/LinkedInComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-linkedin-starter/src/main/java/org/apache/camel/component/linkedin/springboot/LinkedInComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.linkedin.LinkedInComponent;
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 LinkedInComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(LinkedInComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private LinkedInComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<LinkedInComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private LinkedInComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class LinkedInComponentAutoConfiguration {
LinkedInComponent component = new LinkedInComponent();
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 LinkedInComponentAutoConfiguration {
}
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<LinkedInComponent> 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.linkedin.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.linkedin.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-lucene-starter/src/main/java/org/apache/camel/component/lucene/springboot/LuceneComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-lucene-starter/src/main/java/org/apache/camel/component/lucene/springboot/LuceneComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-lucene-starter/src/main/java/org/apache/camel/component/lucene/springboot/LuceneComponentAutoConfiguration.java
index db461b6..42d5a00 100644
--- a/platforms/spring-boot/components-starter/camel-lucene-starter/src/main/java/org/apache/camel/component/lucene/springboot/LuceneComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-lucene-starter/src/main/java/org/apache/camel/component/lucene/springboot/LuceneComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.lucene.LuceneComponent;
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 LuceneComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(LuceneComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private LuceneComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<LuceneComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private LuceneComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class LuceneComponentAutoConfiguration {
LuceneComponent component = new LuceneComponent();
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 LuceneComponentAutoConfiguration {
}
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<LuceneComponent> 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.lucene.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.lucene.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-lumberjack-starter/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-lumberjack-starter/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-lumberjack-starter/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentAutoConfiguration.java
index 0bb6a3e..3ffce00 100644
--- a/platforms/spring-boot/components-starter/camel-lumberjack-starter/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-lumberjack-starter/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.lumberjack.LumberjackComponent;
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 LumberjackComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(LumberjackComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private LumberjackComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<LumberjackComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private LumberjackComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class LumberjackComponentAutoConfiguration {
LumberjackComponent component = new LumberjackComponent();
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 LumberjackComponentAutoConfiguration {
}
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<LumberjackComponent> 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.lumberjack.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.lumberjack.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-lzf-starter/src/main/java/org/apache/camel/dataformat/lzf/springboot/LZFDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-lzf-starter/src/main/java/org/apache/camel/dataformat/lzf/springboot/LZFDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-lzf-starter/src/main/java/org/apache/camel/dataformat/lzf/springboot/LZFDataFormatAutoConfiguration.java
index cea9e9e..cc1a22c 100644
--- a/platforms/spring-boot/components-starter/camel-lzf-starter/src/main/java/org/apache/camel/dataformat/lzf/springboot/LZFDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-lzf-starter/src/main/java/org/apache/camel/dataformat/lzf/springboot/LZFDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.lzf.LZFDataFormat;
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 LZFDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(LZFDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private LZFDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<LZFDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private LZFDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class LZFDataFormatAutoConfiguration {
}
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 LZFDataFormatAutoConfiguration {
} 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<LZFDataFormat> 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.lzf.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.lzf.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-mail-starter/src/main/java/org/apache/camel/component/mail/springboot/MailComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/component/mail/springboot/MailComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/component/mail/springboot/MailComponentAutoConfiguration.java
index 6dc403d..bc60f22 100644
--- a/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/component/mail/springboot/MailComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/component/mail/springboot/MailComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.mail.MailComponent;
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 MailComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(MailComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private MailComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<MailComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private MailComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class MailComponentAutoConfiguration {
MailComponent component = new MailComponent();
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 MailComponentAutoConfiguration {
}
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<MailComponent> 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.mail.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.mail.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-mail-starter/src/main/java/org/apache/camel/dataformat/mime/multipart/springboot/MimeMultipartDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/dataformat/mime/multipart/springboot/MimeMultipartDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/dataformat/mime/multipart/springboot/MimeMultipartDataFormatAutoConfiguration.java
index 495c0fb..ca07ac0 100644
--- a/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/dataformat/mime/multipart/springboot/MimeMultipartDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/dataformat/mime/multipart/springboot/MimeMultipartDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.mime.multipart.MimeMultipartDataFormat;
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 MimeMultipartDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(MimeMultipartDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private MimeMultipartDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<MimeMultipartDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private MimeMultipartDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class MimeMultipartDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,27 @@ public class MimeMultipartDataFormatAutoConfiguration {
} 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<MimeMultipartDataFormat> 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.mime-multipart.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.mime-multipart.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-metrics-starter/src/main/java/org/apache/camel/component/metrics/springboot/MetricsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-metrics-starter/src/main/java/org/apache/camel/component/metrics/springboot/MetricsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-metrics-starter/src/main/java/org/apache/camel/component/metrics/springboot/MetricsComponentAutoConfiguration.java
index 38b6c78..cb3c6dc 100644
--- a/platforms/spring-boot/components-starter/camel-metrics-starter/src/main/java/org/apache/camel/component/metrics/springboot/MetricsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-metrics-starter/src/main/java/org/apache/camel/component/metrics/springboot/MetricsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.metrics.MetricsComponent;
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 MetricsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(MetricsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private MetricsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<MetricsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private MetricsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class MetricsComponentAutoConfiguration {
MetricsComponent component = new MetricsComponent();
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 MetricsComponentAutoConfiguration {
}
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<MetricsComponent> 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.metrics.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.metrics.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-milo-starter/src/main/java/org/apache/camel/component/milo/client/springboot/MiloClientComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-milo-starter/src/main/java/org/apache/camel/component/milo/client/springboot/MiloClientComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-milo-starter/src/main/java/org/apache/camel/component/milo/client/springboot/MiloClientComponentAutoConfiguration.java
index e2fe9a9..00e6832 100644
--- a/platforms/spring-boot/components-starter/camel-milo-starter/src/main/java/org/apache/camel/component/milo/client/springboot/MiloClientComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-milo-starter/src/main/java/org/apache/camel/component/milo/client/springboot/MiloClientComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.milo.client.MiloClientComponent;
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 MiloClientComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(MiloClientComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private MiloClientComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<MiloClientComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private MiloClientComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class MiloClientComponentAutoConfiguration {
MiloClientComponent component = new MiloClientComponent();
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 MiloClientComponentAutoConfiguration {
}
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<MiloClientComponent> 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-client.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.milo-client.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
[17/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java
index 64ca5b5..7624323 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.file.FileComponent;
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 FileComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(FileComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private FileComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<FileComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private FileComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class FileComponentAutoConfiguration {
FileComponent component = new FileComponent();
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 FileComponentAutoConfiguration {
}
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<FileComponent> 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.file.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.file.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-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java
index 8745a45..d1bff54 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.language.LanguageComponent;
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 LanguageComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(LanguageComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private LanguageComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<LanguageComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private LanguageComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class LanguageComponentAutoConfiguration {
LanguageComponent component = new LanguageComponent();
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 LanguageComponentAutoConfiguration {
}
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<LanguageComponent> 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.language.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.language.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-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentAutoConfiguration.java
index b764966..f3160ea 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.log.LogComponent;
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 LogComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(LogComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private LogComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<LogComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private LogComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class LogComponentAutoConfiguration {
LogComponent component = new LogComponent();
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 LogComponentAutoConfiguration {
}
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<LogComponent> 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.log.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.log.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-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java
index b8a7114..bf7d07d 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.mock.MockComponent;
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 MockComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(MockComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private MockComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<MockComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private MockComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class MockComponentAutoConfiguration {
MockComponent component = new MockComponent();
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 MockComponentAutoConfiguration {
}
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<MockComponent> 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.mock.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.mock.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-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentAutoConfiguration.java
index 0867c37..f8e23ec 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.properties.PropertiesComponent;
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 PropertiesComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(PropertiesComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private PropertiesComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<PropertiesComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private PropertiesComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class PropertiesComponentAutoConfiguration {
PropertiesComponent component = new PropertiesComponent();
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 PropertiesComponentAutoConfiguration {
}
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<PropertiesComponent> 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.properties.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.properties.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-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java
index 8e1e763..b1f2cc9 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ref.RefComponent;
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 RefComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(RefComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private RefComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<RefComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private RefComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class RefComponentAutoConfiguration {
RefComponent component = new RefComponent();
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 RefComponentAutoConfiguration {
}
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<RefComponent> 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.ref.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ref.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-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java
index f0563bfb..0045b66 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.rest.RestApiComponent;
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 RestApiComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(RestApiComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private RestApiComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<RestApiComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private RestApiComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class RestApiComponentAutoConfiguration {
RestApiComponent component = new RestApiComponent();
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 RestApiComponentAutoConfiguration {
}
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<RestApiComponent> 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-api.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.rest-api.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-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java
index 5d6cc27..018d732 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.rest.RestComponent;
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 RestComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(RestComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private RestComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<RestComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private RestComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class RestComponentAutoConfiguration {
RestComponent component = new RestComponent();
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 RestComponentAutoConfiguration {
}
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<RestComponent> 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.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.rest.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-core-starter/src/main/java/org/apache/camel/component/scheduler/springboot/SchedulerComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/scheduler/springboot/SchedulerComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/scheduler/springboot/SchedulerComponentAutoConfiguration.java
index bd51f88..9e938f0 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/scheduler/springboot/SchedulerComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/scheduler/springboot/SchedulerComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.scheduler.SchedulerComponent;
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 SchedulerComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SchedulerComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SchedulerComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SchedulerComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SchedulerComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SchedulerComponentAutoConfiguration {
SchedulerComponent component = new SchedulerComponent();
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 SchedulerComponentAutoConfiguration {
}
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<SchedulerComponent> 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.scheduler.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.scheduler.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-core-starter/src/main/java/org/apache/camel/component/seda/springboot/SedaComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/seda/springboot/SedaComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/seda/springboot/SedaComponentAutoConfiguration.java
index bba2092..5097003 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/seda/springboot/SedaComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/seda/springboot/SedaComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.seda.SedaComponent;
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 SedaComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SedaComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SedaComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SedaComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SedaComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SedaComponentAutoConfiguration {
SedaComponent component = new SedaComponent();
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 SedaComponentAutoConfiguration {
}
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<SedaComponent> 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.seda.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.seda.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/stub/springboot/StubComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/stub/springboot/StubComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/stub/springboot/StubComponentAutoConfiguration.java
index 0efd8d4..da349cf 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/stub/springboot/StubComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/stub/springboot/StubComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.stub.StubComponent;
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 StubComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(StubComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private StubComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<StubComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private StubComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class StubComponentAutoConfiguration {
StubComponent component = new StubComponent();
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 StubComponentAutoConfiguration {
}
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<StubComponent> 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.stub.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.stub.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-core-starter/src/main/java/org/apache/camel/component/test/springboot/TestComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/test/springboot/TestComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/test/springboot/TestComponentAutoConfiguration.java
index a71b9b2..7a8ff61 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/test/springboot/TestComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/test/springboot/TestComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.test.TestComponent;
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 TestComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(TestComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private TestComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<TestComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private TestComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class TestComponentAutoConfiguration {
TestComponent component = new TestComponent();
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 TestComponentAutoConfiguration {
}
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<TestComponent> 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.test.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.test.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-core-starter/src/main/java/org/apache/camel/component/timer/springboot/TimerComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/timer/springboot/TimerComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/timer/springboot/TimerComponentAutoConfiguration.java
index 06f7e98..5dfffd4 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/timer/springboot/TimerComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/timer/springboot/TimerComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.timer.TimerComponent;
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 TimerComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(TimerComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private TimerComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<TimerComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private TimerComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class TimerComponentAutoConfiguration {
TimerComponent component = new TimerComponent();
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 TimerComponentAutoConfiguration {
}
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<TimerComponent> 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.timer.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.timer.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-core-starter/src/main/java/org/apache/camel/component/validator/springboot/ValidatorComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/validator/springboot/ValidatorComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/validator/springboot/ValidatorComponentAutoConfiguration.java
index e635323..2d369b8 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/validator/springboot/ValidatorComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/validator/springboot/ValidatorComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.validator.ValidatorComponent;
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 ValidatorComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ValidatorComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ValidatorComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ValidatorComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ValidatorComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class ValidatorComponentAutoConfiguration {
ValidatorComponent component = new ValidatorComponent();
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 ValidatorComponentAutoConfiguration {
}
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<ValidatorComponent> 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.validator.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.validator.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/vm/springboot/VmComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/vm/springboot/VmComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/vm/springboot/VmComponentAutoConfiguration.java
index d013a15..6b4e184 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/vm/springboot/VmComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/vm/springboot/VmComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.vm.VmComponent;
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 VmComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(VmComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private VmComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<VmComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private VmComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class VmComponentAutoConfiguration {
VmComponent component = new VmComponent();
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 VmComponentAutoConfiguration {
}
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<VmComponent> 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.vm.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.vm.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-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentAutoConfiguration.java
index 8e5036d..3c2de04 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/xslt/springboot/XsltComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.xslt.XsltComponent;
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 XsltComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(XsltComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private XsltComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<XsltComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private XsltComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class XsltComponentAutoConfiguration {
XsltComponent component = new XsltComponent();
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 XsltComponentAutoConfiguration {
}
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<XsltComponent> 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.xslt.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.xslt.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
[16/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/GzipDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/GzipDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/GzipDataFormatAutoConfiguration.java
index b032bf4..e33f52a 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/GzipDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/GzipDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.impl.GzipDataFormat;
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 GzipDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GzipDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GzipDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<GzipDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private GzipDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class GzipDataFormatAutoConfiguration {
}
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 GzipDataFormatAutoConfiguration {
} 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<GzipDataFormat> 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.gzip.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.gzip.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-core-starter/src/main/java/org/apache/camel/impl/springboot/SerializationDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/SerializationDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/SerializationDataFormatAutoConfiguration.java
index 9add340..1b4a2e4 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/SerializationDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/SerializationDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.impl.SerializationDataFormat;
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 SerializationDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SerializationDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SerializationDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<SerializationDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private SerializationDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class SerializationDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,27 @@ public class SerializationDataFormatAutoConfiguration {
} 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<SerializationDataFormat> 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.serialization.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.serialization.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-core-starter/src/main/java/org/apache/camel/impl/springboot/StringDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/StringDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/StringDataFormatAutoConfiguration.java
index 61cd3e8..fa5d43e 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/StringDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/StringDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.impl.StringDataFormat;
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 StringDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(StringDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private StringDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<StringDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private StringDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class StringDataFormatAutoConfiguration {
}
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 StringDataFormatAutoConfiguration {
} 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<StringDataFormat> 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.string.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.string.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-core-starter/src/main/java/org/apache/camel/impl/springboot/ZipDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/ZipDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/ZipDataFormatAutoConfiguration.java
index ee2055b..48e18fc 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/ZipDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/impl/springboot/ZipDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.impl.ZipDataFormat;
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 ZipDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ZipDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ZipDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<ZipDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private ZipDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class ZipDataFormatAutoConfiguration {
}
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 ZipDataFormatAutoConfiguration {
} 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<ZipDataFormat> 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.zip.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.zip.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-core-starter/src/main/java/org/apache/camel/language/bean/springboot/BeanLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/bean/springboot/BeanLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/bean/springboot/BeanLanguageAutoConfiguration.java
index 1609ee2..2cf6d2c 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/bean/springboot/BeanLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/bean/springboot/BeanLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.bean.BeanLanguage;
+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 BeanLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BeanLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BeanLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<BeanLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private BeanLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class BeanLanguageAutoConfiguration {
}
}
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<BeanLanguage> 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.bean.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.bean.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-core-starter/src/main/java/org/apache/camel/language/constant/springboot/ConstantLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/constant/springboot/ConstantLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/constant/springboot/ConstantLanguageAutoConfiguration.java
index 43b284c..6772995 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/constant/springboot/ConstantLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/constant/springboot/ConstantLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.constant.ConstantLanguage;
+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 ConstantLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ConstantLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ConstantLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<ConstantLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private ConstantLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class ConstantLanguageAutoConfiguration {
}
}
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<ConstantLanguage> 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.constant.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.constant.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-core-starter/src/main/java/org/apache/camel/language/header/springboot/HeaderLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/header/springboot/HeaderLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/header/springboot/HeaderLanguageAutoConfiguration.java
index b1ec2b2..9960476 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/header/springboot/HeaderLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/header/springboot/HeaderLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.header.HeaderLanguage;
+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 HeaderLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HeaderLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HeaderLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<HeaderLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private HeaderLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class HeaderLanguageAutoConfiguration {
}
}
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<HeaderLanguage> 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.header.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.header.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-core-starter/src/main/java/org/apache/camel/language/property/springboot/ExchangePropertyLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/property/springboot/ExchangePropertyLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/property/springboot/ExchangePropertyLanguageAutoConfiguration.java
index c9d29de..ff3fe62 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/property/springboot/ExchangePropertyLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/property/springboot/ExchangePropertyLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.property.ExchangePropertyLanguage;
+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 ExchangePropertyLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ExchangePropertyLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ExchangePropertyLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<ExchangePropertyLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private ExchangePropertyLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -87,18 +90,27 @@ public class ExchangePropertyLanguageAutoConfiguration {
}
}
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<ExchangePropertyLanguage> 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.exchangeproperty.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.exchangeproperty.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-core-starter/src/main/java/org/apache/camel/language/ref/springboot/RefLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/ref/springboot/RefLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/ref/springboot/RefLanguageAutoConfiguration.java
index 59a14a9..f5cfe0b 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/ref/springboot/RefLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/ref/springboot/RefLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.ref.RefLanguage;
+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 RefLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(RefLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private RefLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<RefLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private RefLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class RefLanguageAutoConfiguration {
}
}
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<RefLanguage> 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.ref.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.ref.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-core-starter/src/main/java/org/apache/camel/language/simple/springboot/FileLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/FileLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/FileLanguageAutoConfiguration.java
index c4d1bdf..91f97ec 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/FileLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/FileLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.simple.FileLanguage;
+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 FileLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(FileLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private FileLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<FileLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private FileLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class FileLanguageAutoConfiguration {
}
}
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<FileLanguage> 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.file.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.file.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-core-starter/src/main/java/org/apache/camel/language/simple/springboot/SimpleLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/SimpleLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/SimpleLanguageAutoConfiguration.java
index 9f46faf..44a54f7 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/SimpleLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/simple/springboot/SimpleLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.simple.SimpleLanguage;
+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 SimpleLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SimpleLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SimpleLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<SimpleLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private SimpleLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class SimpleLanguageAutoConfiguration {
}
}
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<SimpleLanguage> 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.simple.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.simple.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-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/TokenizeLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/TokenizeLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/TokenizeLanguageAutoConfiguration.java
index bea928e..8fb4ce7 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/TokenizeLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/TokenizeLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.tokenizer.TokenizeLanguage;
+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 TokenizeLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(TokenizeLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private TokenizeLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<TokenizeLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private TokenizeLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class TokenizeLanguageAutoConfiguration {
}
}
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<TokenizeLanguage> 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.tokenize.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.tokenize.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-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/XMLTokenizeLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/XMLTokenizeLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/XMLTokenizeLanguageAutoConfiguration.java
index 77b56b7..cf96e70 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/XMLTokenizeLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/tokenizer/springboot/XMLTokenizeLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.tokenizer.XMLTokenizeLanguage;
+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 XMLTokenizeLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(XMLTokenizeLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private XMLTokenizeLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<XMLTokenizeLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private XMLTokenizeLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class XMLTokenizeLanguageAutoConfiguration {
}
}
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<XMLTokenizeLanguage> 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.xtokenize.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.xtokenize.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-core-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageAutoConfiguration.java
index 8a72c47..ade494a 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.xpath.XPathLanguage;
+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 XPathLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(XPathLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private XPathLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<XPathLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private XPathLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class XPathLanguageAutoConfiguration {
}
}
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<XPathLanguage> 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.xpath.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.xpath.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-couchbase-starter/src/main/java/org/apache/camel/component/couchbase/springboot/CouchbaseComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-couchbase-starter/src/main/java/org/apache/camel/component/couchbase/springboot/CouchbaseComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-couchbase-starter/src/main/java/org/apache/camel/component/couchbase/springboot/CouchbaseComponentAutoConfiguration.java
index c1457a2..35df668 100644
--- a/platforms/spring-boot/components-starter/camel-couchbase-starter/src/main/java/org/apache/camel/component/couchbase/springboot/CouchbaseComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-couchbase-starter/src/main/java/org/apache/camel/component/couchbase/springboot/CouchbaseComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.couchbase.CouchbaseComponent;
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 CouchbaseComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CouchbaseComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CouchbaseComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<CouchbaseComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private CouchbaseComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class CouchbaseComponentAutoConfiguration {
CouchbaseComponent component = new CouchbaseComponent();
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 CouchbaseComponentAutoConfiguration {
}
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<CouchbaseComponent> 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.couchbase.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.couchbase.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-couchdb-starter/src/main/java/org/apache/camel/component/couchdb/springboot/CouchDbComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-couchdb-starter/src/main/java/org/apache/camel/component/couchdb/springboot/CouchDbComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-couchdb-starter/src/main/java/org/apache/camel/component/couchdb/springboot/CouchDbComponentAutoConfiguration.java
index c974dd5..f27815e 100644
--- a/platforms/spring-boot/components-starter/camel-couchdb-starter/src/main/java/org/apache/camel/component/couchdb/springboot/CouchDbComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-couchdb-starter/src/main/java/org/apache/camel/component/couchdb/springboot/CouchDbComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.couchdb.CouchDbComponent;
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 CouchDbComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CouchDbComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CouchDbComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<CouchDbComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private CouchDbComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class CouchDbComponentAutoConfiguration {
CouchDbComponent component = new CouchDbComponent();
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 CouchDbComponentAutoConfiguration {
}
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<CouchDbComponent> 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.couchdb.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.couchdb.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-crypto-starter/src/main/java/org/apache/camel/component/crypto/springboot/DigitalSignatureComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/component/crypto/springboot/DigitalSignatureComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/component/crypto/springboot/DigitalSignatureComponentAutoConfiguration.java
index 524af67..faa8789 100644
--- a/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/component/crypto/springboot/DigitalSignatureComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/component/crypto/springboot/DigitalSignatureComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.crypto.DigitalSignatureComponent;
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 DigitalSignatureComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(DigitalSignatureComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private DigitalSignatureComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<DigitalSignatureComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private DigitalSignatureComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class DigitalSignatureComponentAutoConfiguration {
DigitalSignatureComponent component = new DigitalSignatureComponent();
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 DigitalSignatureComponentAutoConfiguration {
}
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<DigitalSignatureComponent> 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.crypto.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.crypto.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
[15/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/CryptoDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/CryptoDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/CryptoDataFormatAutoConfiguration.java
index 6990043..e73ff3e 100644
--- a/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/CryptoDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/CryptoDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.converter.crypto.CryptoDataFormat;
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 CryptoDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CryptoDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CryptoDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<CryptoDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private CryptoDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class CryptoDataFormatAutoConfiguration {
}
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 CryptoDataFormatAutoConfiguration {
} 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<CryptoDataFormat> 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.crypto.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.crypto.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-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/PGPDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/PGPDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/PGPDataFormatAutoConfiguration.java
index fc2bdcb..206df81 100644
--- a/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/PGPDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-crypto-starter/src/main/java/org/apache/camel/converter/crypto/springboot/PGPDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.converter.crypto.PGPDataFormat;
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 PGPDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(PGPDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private PGPDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<PGPDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private PGPDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class PGPDataFormatAutoConfiguration {
}
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 PGPDataFormatAutoConfiguration {
} 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<PGPDataFormat> 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.pgp.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.pgp.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-csv-starter/src/main/java/org/apache/camel/dataformat/csv/springboot/CsvDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-csv-starter/src/main/java/org/apache/camel/dataformat/csv/springboot/CsvDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-csv-starter/src/main/java/org/apache/camel/dataformat/csv/springboot/CsvDataFormatAutoConfiguration.java
index 7a3ae74..1fb201d 100644
--- a/platforms/spring-boot/components-starter/camel-csv-starter/src/main/java/org/apache/camel/dataformat/csv/springboot/CsvDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-csv-starter/src/main/java/org/apache/camel/dataformat/csv/springboot/CsvDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.csv.CsvDataFormat;
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 CsvDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CsvDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CsvDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<CsvDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private CsvDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class CsvDataFormatAutoConfiguration {
}
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 CsvDataFormatAutoConfiguration {
} 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<CsvDataFormat> 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.csv.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.csv.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/jaxrs/springboot/CxfRsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/jaxrs/springboot/CxfRsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/jaxrs/springboot/CxfRsComponentAutoConfiguration.java
index 2161483..4338ddf 100644
--- a/platforms/spring-boot/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/jaxrs/springboot/CxfRsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/jaxrs/springboot/CxfRsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.cxf.jaxrs.CxfRsComponent;
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 CxfRsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CxfRsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CxfRsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<CxfRsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private CxfRsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class CxfRsComponentAutoConfiguration {
CxfRsComponent component = new CxfRsComponent();
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 CxfRsComponentAutoConfiguration {
}
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<CxfRsComponent> 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.cxfrs.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.cxfrs.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-cxf-starter/src/main/java/org/apache/camel/component/cxf/springboot/CxfComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/springboot/CxfComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/springboot/CxfComponentAutoConfiguration.java
index 7f13d51..879657e 100644
--- a/platforms/spring-boot/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/springboot/CxfComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-cxf-starter/src/main/java/org/apache/camel/component/cxf/springboot/CxfComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.cxf.CxfComponent;
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 CxfComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CxfComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CxfComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<CxfComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private CxfComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class CxfComponentAutoConfiguration {
CxfComponent component = new CxfComponent();
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 CxfComponentAutoConfiguration {
}
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<CxfComponent> 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.cxf.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.cxf.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-digitalocean-starter/src/main/java/org/apache/camel/component/digitalocean/springboot/DigitalOceanComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-digitalocean-starter/src/main/java/org/apache/camel/component/digitalocean/springboot/DigitalOceanComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-digitalocean-starter/src/main/java/org/apache/camel/component/digitalocean/springboot/DigitalOceanComponentAutoConfiguration.java
index 1cf5b24..5aa879e 100644
--- a/platforms/spring-boot/components-starter/camel-digitalocean-starter/src/main/java/org/apache/camel/component/digitalocean/springboot/DigitalOceanComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-digitalocean-starter/src/main/java/org/apache/camel/component/digitalocean/springboot/DigitalOceanComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.digitalocean.DigitalOceanComponent;
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 DigitalOceanComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(DigitalOceanComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private DigitalOceanComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<DigitalOceanComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private DigitalOceanComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class DigitalOceanComponentAutoConfiguration {
DigitalOceanComponent component = new DigitalOceanComponent();
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 DigitalOceanComponentAutoConfiguration {
}
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<DigitalOceanComponent> 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.digitalocean.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.digitalocean.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-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/springboot/DisruptorComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/springboot/DisruptorComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/springboot/DisruptorComponentAutoConfiguration.java
index 44c34d4..445dc9b 100644
--- a/platforms/spring-boot/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/springboot/DisruptorComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/springboot/DisruptorComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.disruptor.DisruptorComponent;
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 DisruptorComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(DisruptorComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private DisruptorComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<DisruptorComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private DisruptorComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class DisruptorComponentAutoConfiguration {
DisruptorComponent component = new DisruptorComponent();
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 DisruptorComponentAutoConfiguration {
}
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<DisruptorComponent> 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.disruptor.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.disruptor.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-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/vm/springboot/DisruptorVmComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/vm/springboot/DisruptorVmComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/vm/springboot/DisruptorVmComponentAutoConfiguration.java
index 383105f..194a313 100644
--- a/platforms/spring-boot/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/vm/springboot/DisruptorVmComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-disruptor-starter/src/main/java/org/apache/camel/component/disruptor/vm/springboot/DisruptorVmComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.disruptor.vm.DisruptorVmComponent;
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 DisruptorVmComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(DisruptorVmComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private DisruptorVmComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<DisruptorVmComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private DisruptorVmComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class DisruptorVmComponentAutoConfiguration {
DisruptorVmComponent component = new DisruptorVmComponent();
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 DisruptorVmComponentAutoConfiguration {
}
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<DisruptorVmComponent> 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.disruptor-vm.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.disruptor-vm.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-dns-starter/src/main/java/org/apache/camel/component/dns/springboot/DnsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-dns-starter/src/main/java/org/apache/camel/component/dns/springboot/DnsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-dns-starter/src/main/java/org/apache/camel/component/dns/springboot/DnsComponentAutoConfiguration.java
index 32db459..0faa355 100644
--- a/platforms/spring-boot/components-starter/camel-dns-starter/src/main/java/org/apache/camel/component/dns/springboot/DnsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-dns-starter/src/main/java/org/apache/camel/component/dns/springboot/DnsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.dns.DnsComponent;
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 DnsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(DnsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private DnsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<DnsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private DnsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class DnsComponentAutoConfiguration {
DnsComponent component = new DnsComponent();
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 DnsComponentAutoConfiguration {
}
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<DnsComponent> 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.dns.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.dns.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-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentAutoConfiguration.java
index a098071..581f385 100644
--- a/platforms/spring-boot/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-docker-starter/src/main/java/org/apache/camel/component/docker/springboot/DockerComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.docker.DockerComponent;
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 DockerComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(DockerComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private DockerComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<DockerComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private DockerComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class DockerComponentAutoConfiguration {
DockerComponent component = new DockerComponent();
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 DockerComponentAutoConfiguration {
}
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<DockerComponent> 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.docker.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.docker.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-dozer-starter/src/main/java/org/apache/camel/component/dozer/springboot/DozerComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-dozer-starter/src/main/java/org/apache/camel/component/dozer/springboot/DozerComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-dozer-starter/src/main/java/org/apache/camel/component/dozer/springboot/DozerComponentAutoConfiguration.java
index 1ca0ff4..4185d92 100644
--- a/platforms/spring-boot/components-starter/camel-dozer-starter/src/main/java/org/apache/camel/component/dozer/springboot/DozerComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-dozer-starter/src/main/java/org/apache/camel/component/dozer/springboot/DozerComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.dozer.DozerComponent;
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 DozerComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(DozerComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private DozerComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<DozerComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private DozerComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class DozerComponentAutoConfiguration {
DozerComponent component = new DozerComponent();
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 DozerComponentAutoConfiguration {
}
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<DozerComponent> 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.dozer.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.dozer.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-drill-starter/src/main/java/org/apache/camel/component/drill/springboot/DrillComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-drill-starter/src/main/java/org/apache/camel/component/drill/springboot/DrillComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-drill-starter/src/main/java/org/apache/camel/component/drill/springboot/DrillComponentAutoConfiguration.java
index 93c6e31..74a07b6 100644
--- a/platforms/spring-boot/components-starter/camel-drill-starter/src/main/java/org/apache/camel/component/drill/springboot/DrillComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-drill-starter/src/main/java/org/apache/camel/component/drill/springboot/DrillComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.drill.DrillComponent;
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 DrillComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(DrillComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private DrillComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<DrillComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private DrillComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class DrillComponentAutoConfiguration {
DrillComponent component = new DrillComponent();
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 DrillComponentAutoConfiguration {
}
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<DrillComponent> 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.drill.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.drill.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-dropbox-starter/src/main/java/org/apache/camel/component/dropbox/springboot/DropboxComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-dropbox-starter/src/main/java/org/apache/camel/component/dropbox/springboot/DropboxComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-dropbox-starter/src/main/java/org/apache/camel/component/dropbox/springboot/DropboxComponentAutoConfiguration.java
index 55b25ce..4299c8c 100644
--- a/platforms/spring-boot/components-starter/camel-dropbox-starter/src/main/java/org/apache/camel/component/dropbox/springboot/DropboxComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-dropbox-starter/src/main/java/org/apache/camel/component/dropbox/springboot/DropboxComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.dropbox.DropboxComponent;
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 DropboxComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(DropboxComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private DropboxComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<DropboxComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private DropboxComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class DropboxComponentAutoConfiguration {
DropboxComponent component = new DropboxComponent();
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 DropboxComponentAutoConfiguration {
}
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<DropboxComponent> 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.dropbox.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.dropbox.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-ehcache-starter/src/main/java/org/apache/camel/component/ehcache/springboot/EhcacheComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/main/java/org/apache/camel/component/ehcache/springboot/EhcacheComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/main/java/org/apache/camel/component/ehcache/springboot/EhcacheComponentAutoConfiguration.java
index 9b75f0c..ca3fd11 100644
--- a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/main/java/org/apache/camel/component/ehcache/springboot/EhcacheComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/main/java/org/apache/camel/component/ehcache/springboot/EhcacheComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ehcache.EhcacheComponent;
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 EhcacheComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(EhcacheComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private EhcacheComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<EhcacheComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private EhcacheComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class EhcacheComponentAutoConfiguration {
EhcacheComponent component = new EhcacheComponent();
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 EhcacheComponentAutoConfiguration {
}
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<EhcacheComponent> 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.ehcache.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ehcache.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-ehcache-starter/src/main/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizer.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/main/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizer.java b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/main/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizer.java
index 13cfe54..4ffd233 100644
--- a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/main/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizer.java
+++ b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/main/java/org/apache/camel/component/ehcache/springboot/customizer/CacheManagerCustomizer.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.ehcache.springboot.customizer;
import org.apache.camel.component.ehcache.EhcacheComponent;
import org.apache.camel.component.ehcache.springboot.EhcacheComponentAutoConfiguration;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.ehcache.CacheManager;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,7 +27,6 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.AllNestedConditions;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -50,11 +50,10 @@ import org.springframework.core.annotation.Order;
@Order(Ordered.LOWEST_PRECEDENCE)
@Configuration
@Conditional(CacheManagerCustomizer.NestedConditions.class)
-@ConditionalOnProperty(name = "camel.component.ehcache.customizer.cache-manager.enabled", matchIfMissing = true)
@AutoConfigureAfter(CamelAutoConfiguration.class)
@AutoConfigureBefore(EhcacheComponentAutoConfiguration.class)
@EnableConfigurationProperties(CacheManagerCustomizerConfiguration.class)
-public class CacheManagerCustomizer implements ComponentCustomizer<EhcacheComponent> {
+public class CacheManagerCustomizer implements HasId, ComponentCustomizer<EhcacheComponent> {
@Autowired
private CacheManager cacheManager;
@Autowired
@@ -69,6 +68,11 @@ public class CacheManagerCustomizer implements ComponentCustomizer<EhcacheCompon
}
}
+ @Override
+ public String getId() {
+ return "camel.component.ehcache.customizer.cache-manager";
+ }
+
// *************************************************************************
// By default ConditionalOnBean works using an OR operation so if you list
// a number of classes, the condition succeeds if a single instance of any
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerEnabledOnComponentTest.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerEnabledOnComponentTest.java b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerEnabledOnComponentTest.java
new file mode 100644
index 0000000..b1ac948
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerEnabledOnComponentTest.java
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.ehcache.springboot;
+
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+ classes = {
+ CacheManagerCustomizerEnabledTestBase.TestConfiguration.class
+ },
+ properties = {
+ "debug=false",
+ "camel.component.customizer.enabled=false",
+ "camel.component.ehcache.customizer.enabled=true"
+ })
+public class CacheManagerCustomizerEnabledOnComponentTest extends CacheManagerCustomizerEnabledTestBase {
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerEnabledTest.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerEnabledTest.java b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerEnabledTest.java
new file mode 100644
index 0000000..860c6b7
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerEnabledTest.java
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.ehcache.springboot;
+
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+ classes = {
+ CacheManagerCustomizerEnabledTestBase.TestConfiguration.class
+ },
+ properties = {
+ "debug=false",
+ "camel.component.customizer.enabled=false",
+ "camel.component.ehcache.customizer.enabled=false",
+ "camel.component.ehcache.customizer.cache-manager.enabled=true"
+ })
+public class CacheManagerCustomizerEnabledTest extends CacheManagerCustomizerEnabledTestBase {
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerEnabledTestBase.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerEnabledTestBase.java b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerEnabledTestBase.java
new file mode 100644
index 0000000..5851f3c
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerEnabledTestBase.java
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.ehcache.springboot;
+
+import org.apache.camel.component.ehcache.EhcacheComponent;
+import org.ehcache.CacheManager;
+import org.ehcache.config.builders.CacheManagerBuilder;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+class CacheManagerCustomizerEnabledTestBase {
+ @Autowired
+ CacheManager cacheManager;
+ @Autowired
+ EhcacheComponent component;
+
+ @Test
+ public void testComponentConfiguration() throws Exception {
+ Assert.assertNotNull(cacheManager);
+ Assert.assertNotNull(component);
+ Assert.assertNotNull(component.getCacheManager());
+ }
+
+ @Configuration
+ public static class TestConfiguration {
+ @Bean(initMethod = "init", destroyMethod = "close")
+ public CacheManager cacheManager() {
+ return CacheManagerBuilder.newCacheManagerBuilder().build();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerNotEnabledOnComponentTest.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerNotEnabledOnComponentTest.java b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerNotEnabledOnComponentTest.java
index 7a16ddb..330ba6e 100644
--- a/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerNotEnabledOnComponentTest.java
+++ b/platforms/spring-boot/components-starter/camel-ehcache-starter/src/test/java/org/apache/camel/component/ehcache/springboot/CacheManagerCustomizerNotEnabledOnComponentTest.java
@@ -31,6 +31,7 @@ import org.springframework.test.context.junit4.SpringRunner;
},
properties = {
"debug=false",
+ "camel.component.customizer.enabled=true",
"camel.component.ehcache.customizer.enabled=false"
})
public class CacheManagerCustomizerNotEnabledOnComponentTest extends CacheManagerCustomizerNotEnabledTestBase {
[12/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/queue/springboot/HazelcastQueueComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/queue/springboot/HazelcastQueueComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/queue/springboot/HazelcastQueueComponentAutoConfiguration.java
index 18d9fc7..b584732 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/queue/springboot/HazelcastQueueComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/queue/springboot/HazelcastQueueComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.queue.HazelcastQueueComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HazelcastQueueComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastQueueComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastQueueComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastQueueComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastQueueComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastQueueComponentAutoConfiguration {
HazelcastQueueComponent component = new HazelcastQueueComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,23 @@ public class HazelcastQueueComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HazelcastQueueComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-queue.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-queue.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/springboot/HazelcastReplicatedmapComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/springboot/HazelcastReplicatedmapComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/springboot/HazelcastReplicatedmapComponentAutoConfiguration.java
index 7ddd97f..cf97aee 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/springboot/HazelcastReplicatedmapComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/replicatedmap/springboot/HazelcastReplicatedmapComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.replicatedmap.HazelcastReplicatedmapComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HazelcastReplicatedmapComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastReplicatedmapComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastReplicatedmapComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastReplicatedmapComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastReplicatedmapComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastReplicatedmapComponentAutoConfiguration {
HazelcastReplicatedmapComponent component = new HazelcastReplicatedmapComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,24 @@ public class HazelcastReplicatedmapComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HazelcastReplicatedmapComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator
+ .evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-replicatedmap.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-replicatedmap.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentAutoConfiguration.java
index ede3f52..e8421f1 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/ringbuffer/springboot/HazelcastRingbufferComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.ringbuffer.HazelcastRingbufferComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HazelcastRingbufferComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastRingbufferComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastRingbufferComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastRingbufferComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastRingbufferComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastRingbufferComponentAutoConfiguration {
HazelcastRingbufferComponent component = new HazelcastRingbufferComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,24 @@ public class HazelcastRingbufferComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HazelcastRingbufferComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator
+ .evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-ringbuffer.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-ringbuffer.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentAutoConfiguration.java
index a6ad531..977de89 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/seda/springboot/HazelcastSedaComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.seda.HazelcastSedaComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HazelcastSedaComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastSedaComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastSedaComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastSedaComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastSedaComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastSedaComponentAutoConfiguration {
HazelcastSedaComponent component = new HazelcastSedaComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,23 @@ public class HazelcastSedaComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HazelcastSedaComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-seda.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-seda.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentAutoConfiguration.java
index c2d1c76..dfc6162 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/set/springboot/HazelcastSetComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.set.HazelcastSetComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HazelcastSetComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastSetComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastSetComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastSetComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastSetComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastSetComponentAutoConfiguration {
HazelcastSetComponent component = new HazelcastSetComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,23 @@ public class HazelcastSetComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HazelcastSetComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-set.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-set.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentAutoConfiguration.java
index e672b8f..085d72b 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/topic/springboot/HazelcastTopicComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.topic.HazelcastTopicComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HazelcastTopicComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastTopicComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastTopicComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastTopicComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastTopicComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastTopicComponentAutoConfiguration {
HazelcastTopicComponent component = new HazelcastTopicComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,23 @@ public class HazelcastTopicComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HazelcastTopicComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-topic.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-topic.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hbase-starter/src/main/java/org/apache/camel/component/hbase/springboot/HBaseComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hbase-starter/src/main/java/org/apache/camel/component/hbase/springboot/HBaseComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hbase-starter/src/main/java/org/apache/camel/component/hbase/springboot/HBaseComponentAutoConfiguration.java
index eb71588..e31282d 100644
--- a/platforms/spring-boot/components-starter/camel-hbase-starter/src/main/java/org/apache/camel/component/hbase/springboot/HBaseComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hbase-starter/src/main/java/org/apache/camel/component/hbase/springboot/HBaseComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hbase.HBaseComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HBaseComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HBaseComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HBaseComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HBaseComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HBaseComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class HBaseComponentAutoConfiguration {
HBaseComponent component = new HBaseComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class HBaseComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HBaseComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hbase.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hbase.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentAutoConfiguration.java
index 21c05d9..85fcd8a 100644
--- a/platforms/spring-boot/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hdfs-starter/src/main/java/org/apache/camel/component/hdfs/springboot/HdfsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hdfs.HdfsComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HdfsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HdfsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HdfsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HdfsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HdfsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class HdfsComponentAutoConfiguration {
HdfsComponent component = new HdfsComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class HdfsComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HdfsComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hdfs.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hdfs.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hdfs2-starter/src/main/java/org/apache/camel/component/hdfs2/springboot/HdfsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hdfs2-starter/src/main/java/org/apache/camel/component/hdfs2/springboot/HdfsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hdfs2-starter/src/main/java/org/apache/camel/component/hdfs2/springboot/HdfsComponentAutoConfiguration.java
index a98afb5..803359e 100644
--- a/platforms/spring-boot/components-starter/camel-hdfs2-starter/src/main/java/org/apache/camel/component/hdfs2/springboot/HdfsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hdfs2-starter/src/main/java/org/apache/camel/component/hdfs2/springboot/HdfsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hdfs2.HdfsComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HdfsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HdfsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HdfsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HdfsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HdfsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class HdfsComponentAutoConfiguration {
HdfsComponent component = new HdfsComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class HdfsComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HdfsComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hdfs2.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hdfs2.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java
index a409983..6476903 100644
--- a/platforms/spring-boot/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hessian-starter/src/main/java/org/apache/camel/dataformat/hessian/springboot/HessianDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.hessian.HessianDataFormat;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatCustomizer;
import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -59,13 +62,13 @@ public class HessianDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HessianDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HessianDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<HessianDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private HessianDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class HessianDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,24 @@ public class HessianDataFormatAutoConfiguration {
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && dataformatConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (DataFormatCustomizer<HessianDataFormat> customizer : customizers) {
- LOGGER.debug(
- "Configure dataformat {}, with customizer {}",
- dataformat, customizer);
- customizer.customize(dataformat);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.hessian.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.hessian.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hipchat-starter/src/main/java/org/apache/camel/component/hipchat/springboot/HipchatComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hipchat-starter/src/main/java/org/apache/camel/component/hipchat/springboot/HipchatComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hipchat-starter/src/main/java/org/apache/camel/component/hipchat/springboot/HipchatComponentAutoConfiguration.java
index 96cf954..25ad274 100644
--- a/platforms/spring-boot/components-starter/camel-hipchat-starter/src/main/java/org/apache/camel/component/hipchat/springboot/HipchatComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hipchat-starter/src/main/java/org/apache/camel/component/hipchat/springboot/HipchatComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hipchat.HipchatComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HipchatComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HipchatComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HipchatComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HipchatComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HipchatComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class HipchatComponentAutoConfiguration {
HipchatComponent component = new HipchatComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class HipchatComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HipchatComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hipchat.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hipchat.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java
index 63f7139..5e552c2 100644
--- a/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/HL7DataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.component.hl7.HL7DataFormat;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatCustomizer;
import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -59,13 +62,13 @@ public class HL7DataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HL7DataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HL7DataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<HL7DataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private HL7DataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class HL7DataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -98,15 +101,24 @@ public class HL7DataFormatAutoConfiguration {
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && dataformatConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (DataFormatCustomizer<HL7DataFormat> customizer : customizers) {
- LOGGER.debug(
- "Configure dataformat {}, with customizer {}",
- dataformat, customizer);
- customizer.customize(dataformat);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.hl7.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.hl7.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/TerserLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/TerserLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/TerserLanguageAutoConfiguration.java
index 01c0b46..ac46fdb 100644
--- a/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/TerserLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hl7-starter/src/main/java/org/apache/camel/component/hl7/springboot/TerserLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.component.hl7.TerserLanguage;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spi.LanguageCustomizer;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.LanguageConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -38,6 +40,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -58,13 +61,13 @@ public class TerserLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(TerserLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private TerserLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<TerserLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private TerserLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class TerserLanguageAutoConfiguration {
}
}
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(languageConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), language, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && languageConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (LanguageCustomizer<TerserLanguage> customizer : customizers) {
- LOGGER.debug("Configure language {}, with customizer {}",
- language, customizer);
- customizer.customize(language);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.terser.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.terser.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure language {}, with customizer {}",
+ language, customizer);
+ customizer.customize(language);
+ }
}
}
return language;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentAutoConfiguration.java
index 828ce41..72a66c6 100644
--- a/platforms/spring-boot/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.http.HttpComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HttpComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HttpComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HttpComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HttpComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HttpComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class HttpComponentAutoConfiguration {
HttpComponent component = new HttpComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class HttpComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HttpComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.http.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.http.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-http4-starter/src/main/java/org/apache/camel/component/http4/springboot/HttpComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-http4-starter/src/main/java/org/apache/camel/component/http4/springboot/HttpComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-http4-starter/src/main/java/org/apache/camel/component/http4/springboot/HttpComponentAutoConfiguration.java
index 634bcb0..da71aa9 100644
--- a/platforms/spring-boot/components-starter/camel-http4-starter/src/main/java/org/apache/camel/component/http4/springboot/HttpComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-http4-starter/src/main/java/org/apache/camel/component/http4/springboot/HttpComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.http4.HttpComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class HttpComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HttpComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HttpComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HttpComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HttpComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class HttpComponentAutoConfiguration {
HttpComponent component = new HttpComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class HttpComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<HttpComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.http4.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.http4.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java
index b232923..9abafa4 100644
--- a/platforms/spring-boot/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ical-starter/src/main/java/org/apache/camel/component/ical/springboot/ICalDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.component.ical.ICalDataFormat;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatCustomizer;
import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -59,13 +62,13 @@ public class ICalDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ICalDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ICalDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<ICalDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private ICalDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class ICalDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -98,15 +101,24 @@ public class ICalDataFormatAutoConfiguration {
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && dataformatConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (DataFormatCustomizer<ICalDataFormat> customizer : customizers) {
- LOGGER.debug(
- "Configure dataformat {}, with customizer {}",
- dataformat, customizer);
- customizer.customize(dataformat);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.ical.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.ical.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
[19/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-barcode-starter/src/main/java/org/apache/camel/dataformat/barcode/springboot/BarcodeDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-barcode-starter/src/main/java/org/apache/camel/dataformat/barcode/springboot/BarcodeDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-barcode-starter/src/main/java/org/apache/camel/dataformat/barcode/springboot/BarcodeDataFormatAutoConfiguration.java
index 73a2e3a..b4450b4 100644
--- a/platforms/spring-boot/components-starter/camel-barcode-starter/src/main/java/org/apache/camel/dataformat/barcode/springboot/BarcodeDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-barcode-starter/src/main/java/org/apache/camel/dataformat/barcode/springboot/BarcodeDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.barcode.BarcodeDataFormat;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatCustomizer;
import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -59,13 +62,13 @@ public class BarcodeDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BarcodeDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BarcodeDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<BarcodeDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private BarcodeDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class BarcodeDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,24 @@ public class BarcodeDataFormatAutoConfiguration {
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && dataformatConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (DataFormatCustomizer<BarcodeDataFormat> customizer : customizers) {
- LOGGER.debug(
- "Configure dataformat {}, with customizer {}",
- dataformat, customizer);
- customizer.customize(dataformat);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.barcode.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.barcode.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-base64-starter/src/main/java/org/apache/camel/dataformat/base64/springboot/Base64DataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-base64-starter/src/main/java/org/apache/camel/dataformat/base64/springboot/Base64DataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-base64-starter/src/main/java/org/apache/camel/dataformat/base64/springboot/Base64DataFormatAutoConfiguration.java
index acecd38..e44152f 100644
--- a/platforms/spring-boot/components-starter/camel-base64-starter/src/main/java/org/apache/camel/dataformat/base64/springboot/Base64DataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-base64-starter/src/main/java/org/apache/camel/dataformat/base64/springboot/Base64DataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.base64.Base64DataFormat;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatCustomizer;
import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -59,13 +62,13 @@ public class Base64DataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(Base64DataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private Base64DataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<Base64DataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private Base64DataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class Base64DataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,24 @@ public class Base64DataFormatAutoConfiguration {
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && dataformatConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (DataFormatCustomizer<Base64DataFormat> customizer : customizers) {
- LOGGER.debug(
- "Configure dataformat {}, with customizer {}",
- dataformat, customizer);
- customizer.customize(dataformat);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.base64.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.base64.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-bean-validator-starter/src/main/java/org/apache/camel/component/bean/validator/springboot/BeanValidatorComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-bean-validator-starter/src/main/java/org/apache/camel/component/bean/validator/springboot/BeanValidatorComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-bean-validator-starter/src/main/java/org/apache/camel/component/bean/validator/springboot/BeanValidatorComponentAutoConfiguration.java
index 35eace1..55621c2 100644
--- a/platforms/spring-boot/components-starter/camel-bean-validator-starter/src/main/java/org/apache/camel/component/bean/validator/springboot/BeanValidatorComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-bean-validator-starter/src/main/java/org/apache/camel/component/bean/validator/springboot/BeanValidatorComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.bean.validator.BeanValidatorComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class BeanValidatorComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BeanValidatorComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BeanValidatorComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<BeanValidatorComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private BeanValidatorComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class BeanValidatorComponentAutoConfiguration {
BeanValidatorComponent component = new BeanValidatorComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,23 @@ public class BeanValidatorComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<BeanValidatorComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.bean-validator.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.bean-validator.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-beanio-starter/src/main/java/org/apache/camel/dataformat/beanio/springboot/BeanIODataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-beanio-starter/src/main/java/org/apache/camel/dataformat/beanio/springboot/BeanIODataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-beanio-starter/src/main/java/org/apache/camel/dataformat/beanio/springboot/BeanIODataFormatAutoConfiguration.java
index bc6f2be..95b9d1a 100644
--- a/platforms/spring-boot/components-starter/camel-beanio-starter/src/main/java/org/apache/camel/dataformat/beanio/springboot/BeanIODataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-beanio-starter/src/main/java/org/apache/camel/dataformat/beanio/springboot/BeanIODataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.beanio.BeanIODataFormat;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatCustomizer;
import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -59,13 +62,13 @@ public class BeanIODataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BeanIODataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BeanIODataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<BeanIODataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private BeanIODataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class BeanIODataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,24 @@ public class BeanIODataFormatAutoConfiguration {
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && dataformatConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (DataFormatCustomizer<BeanIODataFormat> customizer : customizers) {
- LOGGER.debug(
- "Configure dataformat {}, with customizer {}",
- dataformat, customizer);
- customizer.customize(dataformat);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.beanio.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.beanio.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentAutoConfiguration.java
index edf07fb..f4ab1f4 100644
--- a/platforms/spring-boot/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-beanstalk-starter/src/main/java/org/apache/camel/component/beanstalk/springboot/BeanstalkComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.beanstalk.BeanstalkComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class BeanstalkComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BeanstalkComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BeanstalkComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<BeanstalkComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private BeanstalkComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class BeanstalkComponentAutoConfiguration {
BeanstalkComponent component = new BeanstalkComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class BeanstalkComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<BeanstalkComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.beanstalk.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.beanstalk.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatAutoConfiguration.java
index e79289a..2c461b3 100644
--- a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/csv/springboot/BindyCsvDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatCustomizer;
import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -59,13 +62,13 @@ public class BindyCsvDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BindyCsvDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BindyCsvDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<BindyCsvDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private BindyCsvDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class BindyCsvDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,27 @@ public class BindyCsvDataFormatAutoConfiguration {
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && dataformatConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (DataFormatCustomizer<BindyCsvDataFormat> customizer : customizers) {
- LOGGER.debug(
- "Configure dataformat {}, with customizer {}",
- dataformat, customizer);
- customizer.customize(dataformat);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator
+ .evaluate(
+ applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.bindy-csv.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.bindy-csv.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatAutoConfiguration.java
index 66381b3..ab8a60a 100644
--- a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/fixed/springboot/BindyFixedLengthDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatCustomizer;
import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -59,13 +62,13 @@ public class BindyFixedLengthDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BindyFixedLengthDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BindyFixedLengthDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<BindyFixedLengthDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private BindyFixedLengthDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class BindyFixedLengthDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,27 @@ public class BindyFixedLengthDataFormatAutoConfiguration {
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && dataformatConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (DataFormatCustomizer<BindyFixedLengthDataFormat> customizer : customizers) {
- LOGGER.debug(
- "Configure dataformat {}, with customizer {}",
- dataformat, customizer);
- customizer.customize(dataformat);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator
+ .evaluate(
+ applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.bindy-fixed.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.bindy-fixed.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatAutoConfiguration.java
index 6b92e6c..ca861bc 100644
--- a/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-bindy-starter/src/main/java/org/apache/camel/dataformat/bindy/kvp/springboot/BindyKeyValuePairDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatCustomizer;
import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -59,13 +62,13 @@ public class BindyKeyValuePairDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BindyKeyValuePairDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BindyKeyValuePairDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<BindyKeyValuePairDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private BindyKeyValuePairDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class BindyKeyValuePairDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,27 @@ public class BindyKeyValuePairDataFormatAutoConfiguration {
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && dataformatConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (DataFormatCustomizer<BindyKeyValuePairDataFormat> customizer : customizers) {
- LOGGER.debug(
- "Configure dataformat {}, with customizer {}",
- dataformat, customizer);
- customizer.customize(dataformat);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator
+ .evaluate(
+ applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.bindy-kvp.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.bindy-kvp.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-bonita-starter/src/main/java/org/apache/camel/component/bonita/springboot/BonitaComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-bonita-starter/src/main/java/org/apache/camel/component/bonita/springboot/BonitaComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-bonita-starter/src/main/java/org/apache/camel/component/bonita/springboot/BonitaComponentAutoConfiguration.java
index 51b5252..bd0b06c 100644
--- a/platforms/spring-boot/components-starter/camel-bonita-starter/src/main/java/org/apache/camel/component/bonita/springboot/BonitaComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-bonita-starter/src/main/java/org/apache/camel/component/bonita/springboot/BonitaComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.bonita.BonitaComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class BonitaComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BonitaComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BonitaComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<BonitaComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private BonitaComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class BonitaComponentAutoConfiguration {
BonitaComponent component = new BonitaComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class BonitaComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<BonitaComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.bonita.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.bonita.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-boon-starter/src/main/java/org/apache/camel/component/boon/springboot/BoonDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-boon-starter/src/main/java/org/apache/camel/component/boon/springboot/BoonDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-boon-starter/src/main/java/org/apache/camel/component/boon/springboot/BoonDataFormatAutoConfiguration.java
index f479cc8..8751a0c 100644
--- a/platforms/spring-boot/components-starter/camel-boon-starter/src/main/java/org/apache/camel/component/boon/springboot/BoonDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-boon-starter/src/main/java/org/apache/camel/component/boon/springboot/BoonDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.component.boon.BoonDataFormat;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatCustomizer;
import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -59,13 +62,13 @@ public class BoonDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BoonDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BoonDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<BoonDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private BoonDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class BoonDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -98,15 +101,24 @@ public class BoonDataFormatAutoConfiguration {
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && dataformatConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (DataFormatCustomizer<BoonDataFormat> customizer : customizers) {
- LOGGER.debug(
- "Configure dataformat {}, with customizer {}",
- dataformat, customizer);
- customizer.customize(dataformat);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.boon.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.boon.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentAutoConfiguration.java
index 797d480..0a4da4a 100644
--- a/platforms/spring-boot/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-box-starter/src/main/java/org/apache/camel/component/box/springboot/BoxComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.box.BoxComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class BoxComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BoxComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BoxComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<BoxComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private BoxComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class BoxComponentAutoConfiguration {
BoxComponent component = new BoxComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class BoxComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<BoxComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.box.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.box.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentAutoConfiguration.java
index 4220f2c..6981fd8 100644
--- a/platforms/spring-boot/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-braintree-starter/src/main/java/org/apache/camel/component/braintree/springboot/BraintreeComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.braintree.BraintreeComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class BraintreeComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BraintreeComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BraintreeComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<BraintreeComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private BraintreeComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class BraintreeComponentAutoConfiguration {
BraintreeComponent component = new BraintreeComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class BraintreeComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<BraintreeComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.braintree.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.braintree.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-cache-starter/src/main/java/org/apache/camel/component/cache/springboot/CacheComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-cache-starter/src/main/java/org/apache/camel/component/cache/springboot/CacheComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-cache-starter/src/main/java/org/apache/camel/component/cache/springboot/CacheComponentAutoConfiguration.java
index 5229475..93694dd 100644
--- a/platforms/spring-boot/components-starter/camel-cache-starter/src/main/java/org/apache/camel/component/cache/springboot/CacheComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-cache-starter/src/main/java/org/apache/camel/component/cache/springboot/CacheComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.cache.CacheComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class CacheComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CacheComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CacheComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<CacheComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private CacheComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class CacheComponentAutoConfiguration {
CacheComponent component = new CacheComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class CacheComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<CacheComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.cache.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.cache.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-cassandraql-starter/src/main/java/org/apache/camel/component/cassandra/springboot/CassandraComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-cassandraql-starter/src/main/java/org/apache/camel/component/cassandra/springboot/CassandraComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-cassandraql-starter/src/main/java/org/apache/camel/component/cassandra/springboot/CassandraComponentAutoConfiguration.java
index a81881e..3cfb911 100644
--- a/platforms/spring-boot/components-starter/camel-cassandraql-starter/src/main/java/org/apache/camel/component/cassandra/springboot/CassandraComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-cassandraql-starter/src/main/java/org/apache/camel/component/cassandra/springboot/CassandraComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.cassandra.CassandraComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class CassandraComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CassandraComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CassandraComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<CassandraComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private CassandraComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class CassandraComponentAutoConfiguration {
CassandraComponent component = new CassandraComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class CassandraComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<CassandraComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.cql.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.cql.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java
index d9b1f9d..e4ccd73 100644
--- a/platforms/spring-boot/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-castor-starter/src/main/java/org/apache/camel/dataformat/castor/springboot/CastorDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.castor.CastorDataFormat;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatCustomizer;
import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -59,13 +62,13 @@ public class CastorDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CastorDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CastorDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<CastorDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private CastorDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class CastorDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,24 @@ public class CastorDataFormatAutoConfiguration {
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && dataformatConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (DataFormatCustomizer<CastorDataFormat> customizer : customizers) {
- LOGGER.debug(
- "Configure dataformat {}, with customizer {}",
- dataformat, customizer);
- customizer.customize(dataformat);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.castor.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.castor.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-chronicle-starter/src/main/java/org/apache/camel/component/chronicle/engine/springboot/ChronicleEngineComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-chronicle-starter/src/main/java/org/apache/camel/component/chronicle/engine/springboot/ChronicleEngineComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-chronicle-starter/src/main/java/org/apache/camel/component/chronicle/engine/springboot/ChronicleEngineComponentAutoConfiguration.java
index 79c5a74..adba8f7 100644
--- a/platforms/spring-boot/components-starter/camel-chronicle-starter/src/main/java/org/apache/camel/component/chronicle/engine/springboot/ChronicleEngineComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-chronicle-starter/src/main/java/org/apache/camel/component/chronicle/engine/springboot/ChronicleEngineComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.chronicle.engine.ChronicleEngineComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class ChronicleEngineComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ChronicleEngineComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ChronicleEngineComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ChronicleEngineComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ChronicleEngineComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class ChronicleEngineComponentAutoConfiguration {
ChronicleEngineComponent component = new ChronicleEngineComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,23 @@ public class ChronicleEngineComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<ChronicleEngineComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.chronicle-engine.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.chronicle-engine.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
[21/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
camel-spring-boot: improve customizer configuration
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1ca7a426
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1ca7a426
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1ca7a426
Branch: refs/heads/master
Commit: 1ca7a4260392663f198c424353522129781dab0a
Parents: ed85770
Author: lburgazzoli <lb...@gmail.com>
Authored: Sun May 21 12:21:59 2017 +0200
Committer: lburgazzoli <lb...@gmail.com>
Committed: Mon May 22 14:02:22 2017 +0200
----------------------------------------------------------------------
.../camel/spring/boot/util/GroupCondition.java | 32 +--
.../util/HierarchicalPropertiesEvaluator.java | 44 ++++
.../spring/boot/util/GroupConditionTest1.java | 49 ++++
.../spring/boot/util/GroupConditionTest2.java | 49 ++++
.../spring/boot/util/GroupConditionTest3.java | 49 ++++
.../spring/boot/util/GroupConditionTest4.java | 49 ++++
.../boot/util/GroupConditionTestBase.java | 41 ++++
.../HierarchicalPropertiesEvaluatorTest.java | 63 +++++
.../src/test/resources/application.properties | 2 +-
.../AhcComponentAutoConfiguration.java | 38 ++-
.../WsComponentAutoConfiguration.java | 38 ++-
.../AMQPComponentAutoConfiguration.java | 38 ++-
.../ApnsComponentAutoConfiguration.java | 38 ++-
.../AsteriskComponentAutoConfiguration.java | 38 ++-
.../AtmosComponentAutoConfiguration.java | 38 ++-
.../WebsocketComponentAutoConfiguration.java | 39 ++-
.../AtomComponentAutoConfiguration.java | 38 ++-
.../AvroComponentAutoConfiguration.java | 38 ++-
.../AvroDataFormatAutoConfiguration.java | 38 ++-
.../CwComponentAutoConfiguration.java | 38 ++-
.../DdbComponentAutoConfiguration.java | 38 ++-
.../DdbStreamComponentAutoConfiguration.java | 38 ++-
.../EC2ComponentAutoConfiguration.java | 38 ++-
...nesisFirehoseComponentAutoConfiguration.java | 39 ++-
.../KinesisComponentAutoConfiguration.java | 38 ++-
.../S3ComponentAutoConfiguration.java | 38 ++-
.../SdbComponentAutoConfiguration.java | 38 ++-
.../SesComponentAutoConfiguration.java | 38 ++-
.../SnsComponentAutoConfiguration.java | 38 ++-
.../SqsComponentAutoConfiguration.java | 38 ++-
.../SWFComponentAutoConfiguration.java | 38 ++-
.../BlobServiceComponentAutoConfiguration.java | 38 ++-
.../QueueServiceComponentAutoConfiguration.java | 38 ++-
.../BarcodeDataFormatAutoConfiguration.java | 38 ++-
.../Base64DataFormatAutoConfiguration.java | 38 ++-
...BeanValidatorComponentAutoConfiguration.java | 38 ++-
.../BeanIODataFormatAutoConfiguration.java | 38 ++-
.../BeanstalkComponentAutoConfiguration.java | 38 ++-
.../BindyCsvDataFormatAutoConfiguration.java | 41 +++-
...yFixedLengthDataFormatAutoConfiguration.java | 41 +++-
...KeyValuePairDataFormatAutoConfiguration.java | 41 +++-
.../BonitaComponentAutoConfiguration.java | 38 ++-
.../BoonDataFormatAutoConfiguration.java | 38 ++-
.../BoxComponentAutoConfiguration.java | 38 ++-
.../BraintreeComponentAutoConfiguration.java | 38 ++-
.../CacheComponentAutoConfiguration.java | 38 ++-
.../CassandraComponentAutoConfiguration.java | 38 ++-
.../CastorDataFormatAutoConfiguration.java | 38 ++-
...ronicleEngineComponentAutoConfiguration.java | 38 ++-
.../ChunkComponentAutoConfiguration.java | 38 ++-
.../CMComponentAutoConfiguration.java | 38 ++-
.../CMISComponentAutoConfiguration.java | 38 ++-
.../CoAPComponentAutoConfiguration.java | 38 ++-
.../CometdComponentAutoConfiguration.java | 38 ++-
.../ConsulComponentAutoConfiguration.java | 38 ++-
...lifiedContextComponentAutoConfiguration.java | 38 ++-
.../BeanComponentAutoConfiguration.java | 38 ++-
.../ClassComponentAutoConfiguration.java | 38 ++-
.../BindingNameComponentAutoConfiguration.java | 38 ++-
.../BrowseComponentAutoConfiguration.java | 38 ++-
.../ControlBusComponentAutoConfiguration.java | 38 ++-
.../DataFormatComponentAutoConfiguration.java | 38 ++-
.../DataSetComponentAutoConfiguration.java | 38 ++-
.../DirectComponentAutoConfiguration.java | 38 ++-
.../DirectVmComponentAutoConfiguration.java | 38 ++-
.../FileComponentAutoConfiguration.java | 38 ++-
.../LanguageComponentAutoConfiguration.java | 38 ++-
.../LogComponentAutoConfiguration.java | 38 ++-
.../MockComponentAutoConfiguration.java | 38 ++-
.../PropertiesComponentAutoConfiguration.java | 38 ++-
.../RefComponentAutoConfiguration.java | 38 ++-
.../RestApiComponentAutoConfiguration.java | 38 ++-
.../RestComponentAutoConfiguration.java | 38 ++-
.../SchedulerComponentAutoConfiguration.java | 38 ++-
.../SedaComponentAutoConfiguration.java | 38 ++-
.../StubComponentAutoConfiguration.java | 38 ++-
.../TestComponentAutoConfiguration.java | 38 ++-
.../TimerComponentAutoConfiguration.java | 38 ++-
.../ValidatorComponentAutoConfiguration.java | 38 ++-
.../VmComponentAutoConfiguration.java | 38 ++-
.../XsltComponentAutoConfiguration.java | 38 ++-
.../GzipDataFormatAutoConfiguration.java | 38 ++-
...erializationDataFormatAutoConfiguration.java | 41 +++-
.../StringDataFormatAutoConfiguration.java | 38 ++-
.../ZipDataFormatAutoConfiguration.java | 38 ++-
.../BeanLanguageAutoConfiguration.java | 38 ++-
.../ConstantLanguageAutoConfiguration.java | 38 ++-
.../HeaderLanguageAutoConfiguration.java | 38 ++-
...changePropertyLanguageAutoConfiguration.java | 38 ++-
.../RefLanguageAutoConfiguration.java | 38 ++-
.../FileLanguageAutoConfiguration.java | 38 ++-
.../SimpleLanguageAutoConfiguration.java | 38 ++-
.../TokenizeLanguageAutoConfiguration.java | 38 ++-
.../XMLTokenizeLanguageAutoConfiguration.java | 38 ++-
.../XPathLanguageAutoConfiguration.java | 38 ++-
.../CouchbaseComponentAutoConfiguration.java | 38 ++-
.../CouchDbComponentAutoConfiguration.java | 38 ++-
...italSignatureComponentAutoConfiguration.java | 38 ++-
.../CryptoDataFormatAutoConfiguration.java | 38 ++-
.../PGPDataFormatAutoConfiguration.java | 38 ++-
.../CsvDataFormatAutoConfiguration.java | 38 ++-
.../CxfRsComponentAutoConfiguration.java | 38 ++-
.../CxfComponentAutoConfiguration.java | 38 ++-
.../DigitalOceanComponentAutoConfiguration.java | 38 ++-
.../DisruptorComponentAutoConfiguration.java | 38 ++-
.../DisruptorVmComponentAutoConfiguration.java | 38 ++-
.../DnsComponentAutoConfiguration.java | 38 ++-
.../DockerComponentAutoConfiguration.java | 38 ++-
.../DozerComponentAutoConfiguration.java | 38 ++-
.../DrillComponentAutoConfiguration.java | 38 ++-
.../DropboxComponentAutoConfiguration.java | 38 ++-
.../EhcacheComponentAutoConfiguration.java | 38 ++-
.../customizer/CacheManagerCustomizer.java | 10 +-
...ManagerCustomizerEnabledOnComponentTest.java | 38 +++
.../CacheManagerCustomizerEnabledTest.java | 39 +++
.../CacheManagerCustomizerEnabledTestBase.java | 48 ++++
...agerCustomizerNotEnabledOnComponentTest.java | 1 +
...ElasticsearchComponentAutoConfiguration.java | 38 ++-
...ElasticsearchComponentAutoConfiguration.java | 38 ++-
.../ElsqlComponentAutoConfiguration.java | 38 ++-
.../EtcdComponentAutoConfiguration.java | 38 ++-
.../ExecComponentAutoConfiguration.java | 38 ++-
.../FacebookComponentAutoConfiguration.java | 38 ++-
.../FlatpackComponentAutoConfiguration.java | 38 ++-
.../FlatpackDataFormatAutoConfiguration.java | 38 ++-
.../FlinkComponentAutoConfiguration.java | 38 ++-
.../FopComponentAutoConfiguration.java | 38 ++-
.../FreemarkerComponentAutoConfiguration.java | 38 ++-
.../FtpComponentAutoConfiguration.java | 38 ++-
.../FtpsComponentAutoConfiguration.java | 38 ++-
.../SftpComponentAutoConfiguration.java | 38 ++-
.../GangliaComponentAutoConfiguration.java | 38 ++-
.../GeoCoderComponentAutoConfiguration.java | 38 ++-
.../GitComponentAutoConfiguration.java | 38 ++-
.../GitHubComponentAutoConfiguration.java | 38 ++-
...oogleCalendarComponentAutoConfiguration.java | 38 ++-
.../GoogleDriveComponentAutoConfiguration.java | 38 ++-
.../GoogleMailComponentAutoConfiguration.java | 38 ++-
.../GooglePubsubComponentAutoConfiguration.java | 38 ++-
.../GoraComponentAutoConfiguration.java | 38 ++-
.../GroovyLanguageAutoConfiguration.java | 38 ++-
.../GrpcComponentAutoConfiguration.java | 38 ++-
.../GsonDataFormatAutoConfiguration.java | 41 +++-
...GuavaEventBusComponentAutoConfiguration.java | 38 ++-
...tAtomicnumberComponentAutoConfiguration.java | 39 ++-
...lcastInstanceComponentAutoConfiguration.java | 39 ++-
...HazelcastListComponentAutoConfiguration.java | 38 ++-
.../HazelcastMapComponentAutoConfiguration.java | 38 ++-
...lcastMultimapComponentAutoConfiguration.java | 39 ++-
...azelcastQueueComponentAutoConfiguration.java | 38 ++-
...ReplicatedmapComponentAutoConfiguration.java | 39 ++-
...astRingbufferComponentAutoConfiguration.java | 39 ++-
...HazelcastSedaComponentAutoConfiguration.java | 38 ++-
.../HazelcastSetComponentAutoConfiguration.java | 38 ++-
...azelcastTopicComponentAutoConfiguration.java | 38 ++-
.../HBaseComponentAutoConfiguration.java | 38 ++-
.../HdfsComponentAutoConfiguration.java | 38 ++-
.../HdfsComponentAutoConfiguration.java | 38 ++-
.../HessianDataFormatAutoConfiguration.java | 38 ++-
.../HipchatComponentAutoConfiguration.java | 38 ++-
.../HL7DataFormatAutoConfiguration.java | 38 ++-
.../TerserLanguageAutoConfiguration.java | 38 ++-
.../HttpComponentAutoConfiguration.java | 38 ++-
.../HttpComponentAutoConfiguration.java | 38 ++-
.../ICalDataFormatAutoConfiguration.java | 38 ++-
.../IgniteCacheComponentAutoConfiguration.java | 38 ++-
...IgniteComputeComponentAutoConfiguration.java | 38 ++-
.../IgniteEventsComponentAutoConfiguration.java | 38 ++-
.../IgniteIdGenComponentAutoConfiguration.java | 38 ++-
...niteMessagingComponentAutoConfiguration.java | 38 ++-
.../IgniteQueueComponentAutoConfiguration.java | 38 ++-
.../IgniteSetComponentAutoConfiguration.java | 38 ++-
.../InfinispanComponentAutoConfiguration.java | 38 ++-
.../InfluxDbComponentAutoConfiguration.java | 38 ++-
.../IrcComponentAutoConfiguration.java | 38 ++-
.../IronMQComponentAutoConfiguration.java | 38 ++-
.../JacksonDataFormatAutoConfiguration.java | 41 +++-
.../JacksonXMLDataFormatAutoConfiguration.java | 41 +++-
.../JavaSpaceComponentAutoConfiguration.java | 38 ++-
.../JaxbDataFormatAutoConfiguration.java | 38 ++-
.../JBPMComponentAutoConfiguration.java | 38 ++-
.../JCacheComponentAutoConfiguration.java | 38 ++-
.../JcrComponentAutoConfiguration.java | 38 ++-
.../JdbcComponentAutoConfiguration.java | 38 ++-
.../JettyHttpComponentAutoConfiguration9.java | 38 ++-
.../JGroupsComponentAutoConfiguration.java | 38 ++-
.../JibxDataFormatAutoConfiguration.java | 38 ++-
.../JingComponentAutoConfiguration.java | 38 ++-
.../JIRAComponentAutoConfiguration.java | 38 ++-
.../JmsComponentAutoConfiguration.java | 38 ++-
.../JMXComponentAutoConfiguration.java | 38 ++-
.../JohnzonDataFormatAutoConfiguration.java | 41 +++-
.../JoltComponentAutoConfiguration.java | 38 ++-
.../SqlLanguageAutoConfiguration.java | 38 ++-
.../JpaComponentAutoConfiguration.java | 38 ++-
.../ScpComponentAutoConfiguration.java | 38 ++-
.../JsonPathLanguageAutoConfiguration.java | 38 ++-
.../Jt400ComponentAutoConfiguration.java | 38 ++-
.../JuelLanguageAutoConfiguration.java | 38 ++-
.../JXPathLanguageAutoConfiguration.java | 38 ++-
.../KafkaComponentAutoConfiguration.java | 38 ++-
.../KestrelComponentAutoConfiguration.java | 38 ++-
.../KratiComponentAutoConfiguration.java | 38 ++-
.../KubernetesComponentAutoConfiguration.java | 38 ++-
.../LdapComponentAutoConfiguration.java | 38 ++-
.../LinkedInComponentAutoConfiguration.java | 38 ++-
.../LuceneComponentAutoConfiguration.java | 38 ++-
.../LumberjackComponentAutoConfiguration.java | 38 ++-
.../LZFDataFormatAutoConfiguration.java | 38 ++-
.../MailComponentAutoConfiguration.java | 38 ++-
...imeMultipartDataFormatAutoConfiguration.java | 41 +++-
.../MetricsComponentAutoConfiguration.java | 38 ++-
.../MiloClientComponentAutoConfiguration.java | 38 ++-
.../MiloServerComponentAutoConfiguration.java | 38 ++-
.../Mina2ComponentAutoConfiguration.java | 38 ++-
.../MllpComponentAutoConfiguration.java | 38 ++-
.../GridFsComponentAutoConfiguration.java | 38 ++-
.../MongoDbComponentAutoConfiguration.java | 38 ++-
.../MongoDbComponentAutoConfiguration.java | 38 ++-
.../MQTTComponentAutoConfiguration.java | 38 ++-
.../MsvComponentAutoConfiguration.java | 38 ++-
.../MustacheComponentAutoConfiguration.java | 38 ++-
.../MvelComponentAutoConfiguration.java | 38 ++-
.../MvelLanguageAutoConfiguration.java | 38 ++-
.../MyBatisComponentAutoConfiguration.java | 38 ++-
.../NagiosComponentAutoConfiguration.java | 38 ++-
.../NatsComponentAutoConfiguration.java | 38 ++-
.../NettyHttpComponentAutoConfiguration.java | 38 ++-
.../NettyComponentAutoConfiguration.java | 38 ++-
.../NettyHttpComponentAutoConfiguration.java | 38 ++-
.../NettyComponentAutoConfiguration.java | 38 ++-
.../OgnlLanguageAutoConfiguration.java | 38 ++-
.../Olingo2ComponentAutoConfiguration.java | 38 ++-
.../Olingo4ComponentAutoConfiguration.java | 38 ++-
.../OpenShiftComponentAutoConfiguration.java | 38 ++-
.../CinderComponentAutoConfiguration.java | 38 ++-
.../GlanceComponentAutoConfiguration.java | 38 ++-
.../KeystoneComponentAutoConfiguration.java | 39 ++-
.../NeutronComponentAutoConfiguration.java | 38 ++-
.../NovaComponentAutoConfiguration.java | 38 ++-
.../SwiftComponentAutoConfiguration.java | 38 ++-
.../OptaPlannerComponentAutoConfiguration.java | 38 ++-
.../PahoComponentAutoConfiguration.java | 38 ++-
.../PdfComponentAutoConfiguration.java | 38 ++-
.../PgEventComponentAutoConfiguration.java | 38 ++-
.../PrinterComponentAutoConfiguration.java | 38 ++-
.../ProtobufDataFormatAutoConfiguration.java | 38 ++-
.../PubNubComponentAutoConfiguration.java | 38 ++-
.../QuartzComponentAutoConfiguration.java | 38 ++-
.../QuickfixjComponentAutoConfiguration.java | 38 ++-
.../RabbitMQComponentAutoConfiguration.java | 38 ++-
...activeStreamsComponentAutoConfiguration.java | 38 ++-
.../RestSwaggerComponentAutoConfiguration.java | 38 ++-
.../RestletComponentAutoConfiguration.java | 38 ++-
.../RmiComponentAutoConfiguration.java | 38 ++-
.../RouteboxComponentAutoConfiguration.java | 38 ++-
.../RssComponentAutoConfiguration.java | 38 ++-
.../RssDataFormatAutoConfiguration.java | 38 ++-
.../SalesforceComponentAutoConfiguration.java | 38 ++-
.../NetWeaverComponentAutoConfiguration.java | 38 ++-
.../XQueryComponentAutoConfiguration.java | 38 ++-
.../XQueryLanguageAutoConfiguration.java | 38 ++-
.../SchematronComponentAutoConfiguration.java | 38 ++-
.../JavaScriptLanguageAutoConfiguration.java | 38 ++-
.../PhpLanguageAutoConfiguration.java | 38 ++-
.../PythonLanguageAutoConfiguration.java | 38 ++-
.../RubyLanguageAutoConfiguration.java | 38 ++-
.../ServiceNowComponentAutoConfiguration.java | 38 ++-
.../ServletComponentAutoConfiguration.java | 38 ++-
.../SipComponentAutoConfiguration.java | 38 ++-
.../SjmsBatchComponentAutoConfiguration.java | 38 ++-
.../SjmsComponentAutoConfiguration.java | 38 ++-
.../Sjms2ComponentAutoConfiguration.java | 38 ++-
.../SlackComponentAutoConfiguration.java | 38 ++-
.../SmppComponentAutoConfiguration.java | 38 ++-
.../SnakeYAMLDataFormatAutoConfiguration.java | 43 ++--
.../SnmpComponentAutoConfiguration.java | 38 ++-
.../SoapJaxbDataFormatAutoConfiguration.java | 38 ++-
.../SolrComponentAutoConfiguration.java | 38 ++-
.../SparkComponentAutoConfiguration.java | 38 ++-
.../SplunkComponentAutoConfiguration.java | 38 ++-
.../SpringBatchComponentAutoConfiguration.java | 38 ++-
...ngIntegrationComponentAutoConfiguration.java | 39 ++-
.../SpringLdapComponentAutoConfiguration.java | 38 ++-
.../RedisComponentAutoConfiguration.java | 38 ++-
.../EventComponentAutoConfiguration.java | 38 ++-
.../SpelLanguageAutoConfiguration.java | 38 ++-
...ingWebserviceComponentAutoConfiguration.java | 38 ++-
.../SqlComponentAutoConfiguration.java | 38 ++-
.../SqlStoredComponentAutoConfiguration.java | 38 ++-
.../SshComponentAutoConfiguration.java | 38 ++-
.../StAXComponentAutoConfiguration.java | 38 ++-
.../StompComponentAutoConfiguration.java | 38 ++-
.../StreamComponentAutoConfiguration.java | 38 ++-
...tringTemplateComponentAutoConfiguration.java | 38 ++-
.../SyslogDataFormatAutoConfiguration.java | 38 ++-
.../TidyMarkupDataFormatAutoConfiguration.java | 41 +++-
.../TarFileDataFormatAutoConfiguration.java | 38 ++-
.../TelegramComponentAutoConfiguration.java | 38 ++-
.../TikaComponentAutoConfiguration.java | 38 ++-
.../TwitterComponentAutoConfiguration.java | 38 ++-
.../UndertowComponentAutoConfiguration.java | 38 ++-
...UniVocityCsvDataFormatAutoConfiguration.java | 41 +++-
...tyFixedWidthDataFormatAutoConfiguration.java | 41 +++-
...UniVocityTsvDataFormatAutoConfiguration.java | 41 +++-
.../VelocityComponentAutoConfiguration.java | 38 ++-
.../VertxComponentAutoConfiguration.java | 38 ++-
.../WeatherComponentAutoConfiguration.java | 38 ++-
.../WebsocketComponentAutoConfiguration.java | 38 ++-
.../XmlBeansDataFormatAutoConfiguration.java | 38 ++-
.../XmlJsonDataFormatAutoConfiguration.java | 38 ++-
.../XmlRpcComponentAutoConfiguration.java | 38 ++-
.../XmlRpcDataFormatAutoConfiguration.java | 38 ++-
.../XmlSignatureComponentAutoConfiguration.java | 38 ++-
.../XMLSecurityDataFormatAutoConfiguration.java | 41 +++-
.../XmppComponentAutoConfiguration.java | 38 ++-
.../JsonDataFormatAutoConfiguration.java | 41 +++-
.../XStreamDataFormatAutoConfiguration.java | 38 ++-
.../YammerComponentAutoConfiguration.java | 38 ++-
.../ZendeskComponentAutoConfiguration.java | 38 ++-
.../ZipFileDataFormatAutoConfiguration.java | 38 ++-
.../MasterComponentAutoConfiguration.java | 38 ++-
.../ZooKeeperComponentAutoConfiguration.java | 38 ++-
.../SpringBootAutoConfigurationMojo.java | 245 +++++++++++--------
324 files changed, 8407 insertions(+), 4153 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/GroupCondition.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/GroupCondition.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/GroupCondition.java
index acfd832..fe18518 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/GroupCondition.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/GroupCondition.java
@@ -19,42 +19,26 @@ package org.apache.camel.spring.boot.util;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
-import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.context.annotation.ConditionContext;
+import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;
public class GroupCondition extends SpringBootCondition {
private final String group;
private final String single;
- private final boolean groupDefault;
- private final boolean singleDefault;
public GroupCondition(String group, String single) {
- this(group, true, single, true);
- }
-
- public GroupCondition(String group, boolean groupDefault, String single, boolean singleDefault) {
- this.group = group.endsWith(".") ? group : group + ".";
- this.groupDefault = groupDefault;
-
- this.single = group.endsWith(".") ? single : single + ".";
- this.singleDefault = singleDefault;
+ this.group = group;
+ this.single = single;
}
@Override
public ConditionOutcome getMatchOutcome(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
- boolean groupEnabled = isEnabled(conditionContext, this.group, true);
- ConditionMessage.Builder message = ConditionMessage.forCondition(this.single);
-
- if (isEnabled(conditionContext, this.single, groupEnabled)) {
- return ConditionOutcome.match(message.because("enabled"));
- }
-
- return ConditionOutcome.noMatch(message.because("not enabled"));
- }
+ final ConditionMessage.Builder message = ConditionMessage.forCondition(this.single);
+ final Environment environment = conditionContext.getEnvironment();
- public static boolean isEnabled(ConditionContext context, String prefix, boolean defaultValue) {
- RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(context.getEnvironment(), prefix);
- return resolver.getProperty("enabled", Boolean.class, defaultValue);
+ return HierarchicalPropertiesEvaluator.evaluate(environment, this.group, this.single)
+ ? ConditionOutcome.match(message.because("enabled"))
+ : ConditionOutcome.noMatch(message.because("not enabled"));
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluator.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluator.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluator.java
new file mode 100644
index 0000000..a41effb
--- /dev/null
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluator.java
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.util;
+
+import org.springframework.boot.bind.RelaxedPropertyResolver;
+import org.springframework.core.env.Environment;
+
+public final class HierarchicalPropertiesEvaluator {
+ private HierarchicalPropertiesEvaluator() {
+ }
+
+ public static boolean evaluate(Environment environment, String... prefixes) {
+ boolean answer = true;
+
+ for (String prefix : prefixes) {
+ answer = isEnabled(environment, prefix, answer);
+ }
+
+ return answer;
+ }
+
+ private static boolean isEnabled(Environment environment, String prefix, boolean defaultValue) {
+ RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(
+ environment,
+ prefix.endsWith(".") ? prefix : prefix + "."
+ );
+
+ return resolver.getProperty("enabled", Boolean.class, defaultValue);
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest1.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest1.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest1.java
new file mode 100644
index 0000000..b8155b7
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest1.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+ classes = {
+ GroupConditionTestBase.TestConfiguration.class
+ },
+ properties = {
+ "test.group.enabled=false",
+ "test.group.my-class.enabled=true"
+ }
+)
+public class GroupConditionTest1 extends GroupConditionTestBase {
+ @Autowired
+ ApplicationContext context;
+
+ @Test
+ public void testCondition() {
+ Assert.assertEquals(1, context.getBeansOfType(MyClass.class).size());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest2.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest2.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest2.java
new file mode 100644
index 0000000..f981acc
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest2.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+ classes = {
+ GroupConditionTest2.TestConfiguration.class
+ },
+ properties = {
+ "test.group.enabled=false",
+ "test.group.my-class.enabled=false"
+ }
+)
+public class GroupConditionTest2 extends GroupConditionTestBase {
+ @Autowired
+ ApplicationContext context;
+
+ @Test
+ public void testCondition() {
+ Assert.assertEquals(0, context.getBeansOfType(MyClass.class).size());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest3.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest3.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest3.java
new file mode 100644
index 0000000..f266d69
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest3.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+ classes = {
+ GroupConditionTest3.TestConfiguration.class
+ },
+ properties = {
+ "test.group.enabled=true",
+ "test.group.my-class.enabled=false"
+ }
+)
+public class GroupConditionTest3 extends GroupConditionTestBase {
+ @Autowired
+ ApplicationContext context;
+
+ @Test
+ public void testCondition() {
+ Assert.assertEquals(0, context.getBeansOfType(MyClass.class).size());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest4.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest4.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest4.java
new file mode 100644
index 0000000..4de3782
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTest4.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+ classes = {
+ GroupConditionTest4.TestConfiguration.class
+ },
+ properties = {
+ "test.group.enabled=true",
+ "test.group.my-class.enabled=true"
+ }
+)
+public class GroupConditionTest4 extends GroupConditionTestBase {
+ @Autowired
+ ApplicationContext context;
+
+ @Test
+ public void testCondition() {
+ Assert.assertEquals(1, context.getBeansOfType(MyClass.class).size());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTestBase.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTestBase.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTestBase.java
new file mode 100644
index 0000000..39e8fdb
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/GroupConditionTestBase.java
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.util;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Conditional;
+import org.springframework.context.annotation.Configuration;
+
+public class GroupConditionTestBase {
+ @Configuration
+ static class TestConfiguration {
+ @Bean
+ @Conditional(TestConfiguration.Conditions.class)
+ public MyClass stringComponent() {
+ return new MyClass();
+ }
+
+ static class Conditions extends GroupCondition {
+ public Conditions() {
+ super("test.group", "test.group.my-class");
+ }
+ }
+ }
+
+ static class MyClass {
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluatorTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluatorTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluatorTest.java
new file mode 100644
index 0000000..6ed08f4
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluatorTest.java
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.spring.boot.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@DirtiesContext
+@SpringBootApplication
+@SpringBootTest(
+ classes = {
+ HierarchicalPropertiesEvaluatorTest.TestConfiguration.class
+ },
+ properties = {
+ "test.group1.enabled=true",
+ "test.group1.subgroup1.enabled=false",
+ "test.group1.subgroup2.enabled=true",
+ "test.group2.enabled=false",
+ "test.group2.subgroup1.enabled=false",
+ "test.group2.subgroup2.enabled=true",
+ "test.group2.subgroup3.enabled=false"
+ }
+)
+public class HierarchicalPropertiesEvaluatorTest {
+ @Autowired
+ Environment environment;
+
+ @Test
+ public void testEvaluator() {
+ Assert.assertFalse(HierarchicalPropertiesEvaluator.evaluate(environment, "test.group1", "test.group1.subgroup1"));
+ Assert.assertTrue(HierarchicalPropertiesEvaluator.evaluate(environment, "test.group1", "test.group1.subgroup2"));
+ Assert.assertFalse(HierarchicalPropertiesEvaluator.evaluate(environment, "test.group2", "test.group2.subgroup1"));
+ Assert.assertTrue(HierarchicalPropertiesEvaluator.evaluate(environment, "test.group2", "test.group2.subgroup2"));
+ Assert.assertFalse(HierarchicalPropertiesEvaluator.evaluate(environment, "test.group2", "test.group2.subgroup3"));
+ }
+
+ @Configuration
+ static class TestConfiguration {
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/components/camel-spring-boot/src/test/resources/application.properties
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/resources/application.properties b/components/camel-spring-boot/src/test/resources/application.properties
index 3056876..518bcd1 100644
--- a/components/camel-spring-boot/src/test/resources/application.properties
+++ b/components/camel-spring-boot/src/test/resources/application.properties
@@ -20,4 +20,4 @@ spring.main.banner_mode=off
from=direct:test
to=mock:test
-#logging.level.org.apache.camel=DEBUG
+#logging.level.org.apache.camel=DEBUG
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-ahc-starter/src/main/java/org/apache/camel/component/ahc/springboot/AhcComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ahc-starter/src/main/java/org/apache/camel/component/ahc/springboot/AhcComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ahc-starter/src/main/java/org/apache/camel/component/ahc/springboot/AhcComponentAutoConfiguration.java
index 2c7a026..a403c94 100644
--- a/platforms/spring-boot/components-starter/camel-ahc-starter/src/main/java/org/apache/camel/component/ahc/springboot/AhcComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ahc-starter/src/main/java/org/apache/camel/component/ahc/springboot/AhcComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ahc.AhcComponent;
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 AhcComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(AhcComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private AhcComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<AhcComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private AhcComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class AhcComponentAutoConfiguration {
AhcComponent component = new AhcComponent();
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 AhcComponentAutoConfiguration {
}
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<AhcComponent> 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.ahc.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ahc.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-ahc-ws-starter/src/main/java/org/apache/camel/component/ahc/ws/springboot/WsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ahc-ws-starter/src/main/java/org/apache/camel/component/ahc/ws/springboot/WsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ahc-ws-starter/src/main/java/org/apache/camel/component/ahc/ws/springboot/WsComponentAutoConfiguration.java
index 42f6a5b..4baf62d 100644
--- a/platforms/spring-boot/components-starter/camel-ahc-ws-starter/src/main/java/org/apache/camel/component/ahc/ws/springboot/WsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ahc-ws-starter/src/main/java/org/apache/camel/component/ahc/ws/springboot/WsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ahc.ws.WsComponent;
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 WsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(WsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private WsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<WsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private WsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class WsComponentAutoConfiguration {
WsComponent component = new WsComponent();
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 WsComponentAutoConfiguration {
}
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<WsComponent> 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.ahc-ws.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ahc-ws.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentAutoConfiguration.java
index 7ef0289..55c0304 100644
--- a/platforms/spring-boot/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-amqp-starter/src/main/java/org/apache/camel/component/amqp/springboot/AMQPComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.amqp.AMQPComponent;
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 AMQPComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(AMQPComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private AMQPComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<AMQPComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private AMQPComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class AMQPComponentAutoConfiguration {
AMQPComponent component = new AMQPComponent();
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 AMQPComponentAutoConfiguration {
}
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<AMQPComponent> 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.amqp.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.amqp.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-apns-starter/src/main/java/org/apache/camel/component/apns/springboot/ApnsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-apns-starter/src/main/java/org/apache/camel/component/apns/springboot/ApnsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-apns-starter/src/main/java/org/apache/camel/component/apns/springboot/ApnsComponentAutoConfiguration.java
index 68405cf..f54a5e6 100644
--- a/platforms/spring-boot/components-starter/camel-apns-starter/src/main/java/org/apache/camel/component/apns/springboot/ApnsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-apns-starter/src/main/java/org/apache/camel/component/apns/springboot/ApnsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.apns.ApnsComponent;
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 ApnsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ApnsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ApnsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ApnsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ApnsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class ApnsComponentAutoConfiguration {
ApnsComponent component = new ApnsComponent();
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 ApnsComponentAutoConfiguration {
}
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<ApnsComponent> 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.apns.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.apns.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-asterisk-starter/src/main/java/org/apache/camel/component/asterisk/springboot/AsteriskComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-asterisk-starter/src/main/java/org/apache/camel/component/asterisk/springboot/AsteriskComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-asterisk-starter/src/main/java/org/apache/camel/component/asterisk/springboot/AsteriskComponentAutoConfiguration.java
index 66d591d..9574063 100644
--- a/platforms/spring-boot/components-starter/camel-asterisk-starter/src/main/java/org/apache/camel/component/asterisk/springboot/AsteriskComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-asterisk-starter/src/main/java/org/apache/camel/component/asterisk/springboot/AsteriskComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.asterisk.AsteriskComponent;
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 AsteriskComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(AsteriskComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private AsteriskComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<AsteriskComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private AsteriskComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class AsteriskComponentAutoConfiguration {
AsteriskComponent component = new AsteriskComponent();
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 AsteriskComponentAutoConfiguration {
}
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<AsteriskComponent> 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.asterisk.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.asterisk.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-atmos-starter/src/main/java/org/apache/camel/component/atmos/springboot/AtmosComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-atmos-starter/src/main/java/org/apache/camel/component/atmos/springboot/AtmosComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-atmos-starter/src/main/java/org/apache/camel/component/atmos/springboot/AtmosComponentAutoConfiguration.java
index a97ff18..ba46617 100644
--- a/platforms/spring-boot/components-starter/camel-atmos-starter/src/main/java/org/apache/camel/component/atmos/springboot/AtmosComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-atmos-starter/src/main/java/org/apache/camel/component/atmos/springboot/AtmosComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.atmos.AtmosComponent;
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 AtmosComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(AtmosComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private AtmosComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<AtmosComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private AtmosComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class AtmosComponentAutoConfiguration {
AtmosComponent component = new AtmosComponent();
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 AtmosComponentAutoConfiguration {
}
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<AtmosComponent> 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.atmos.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.atmos.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-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentAutoConfiguration.java
index 7b21fe5..686616d 100644
--- a/platforms/spring-boot/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-atmosphere-websocket-starter/src/main/java/org/apache/camel/component/atmosphere/websocket/springboot/WebsocketComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.atmosphere.websocket.WebsocketComponent;
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 WebsocketComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(WebsocketComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private WebsocketComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<WebsocketComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private WebsocketComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class WebsocketComponentAutoConfiguration {
WebsocketComponent component = new WebsocketComponent();
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,24 @@ public class WebsocketComponentAutoConfiguration {
}
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<WebsocketComponent> 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.atmosphere-websocket.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.atmosphere-websocket.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-atom-starter/src/main/java/org/apache/camel/component/atom/springboot/AtomComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-atom-starter/src/main/java/org/apache/camel/component/atom/springboot/AtomComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-atom-starter/src/main/java/org/apache/camel/component/atom/springboot/AtomComponentAutoConfiguration.java
index 5f68096..95f5048 100644
--- a/platforms/spring-boot/components-starter/camel-atom-starter/src/main/java/org/apache/camel/component/atom/springboot/AtomComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-atom-starter/src/main/java/org/apache/camel/component/atom/springboot/AtomComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.atom.AtomComponent;
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 AtomComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(AtomComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private AtomComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<AtomComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private AtomComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class AtomComponentAutoConfiguration {
AtomComponent component = new AtomComponent();
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 AtomComponentAutoConfiguration {
}
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<AtomComponent> 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.atom.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.atom.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
[13/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-git-starter/src/main/java/org/apache/camel/component/git/springboot/GitComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-git-starter/src/main/java/org/apache/camel/component/git/springboot/GitComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-git-starter/src/main/java/org/apache/camel/component/git/springboot/GitComponentAutoConfiguration.java
index 2d49b85..e43c3d2 100644
--- a/platforms/spring-boot/components-starter/camel-git-starter/src/main/java/org/apache/camel/component/git/springboot/GitComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-git-starter/src/main/java/org/apache/camel/component/git/springboot/GitComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.git.GitComponent;
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 GitComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GitComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GitComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<GitComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private GitComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class GitComponentAutoConfiguration {
GitComponent component = new GitComponent();
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 GitComponentAutoConfiguration {
}
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<GitComponent> 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.git.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.git.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-github-starter/src/main/java/org/apache/camel/component/github/springboot/GitHubComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-github-starter/src/main/java/org/apache/camel/component/github/springboot/GitHubComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-github-starter/src/main/java/org/apache/camel/component/github/springboot/GitHubComponentAutoConfiguration.java
index f318624..b4b0870 100644
--- a/platforms/spring-boot/components-starter/camel-github-starter/src/main/java/org/apache/camel/component/github/springboot/GitHubComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-github-starter/src/main/java/org/apache/camel/component/github/springboot/GitHubComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.github.GitHubComponent;
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 GitHubComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GitHubComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GitHubComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<GitHubComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private GitHubComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class GitHubComponentAutoConfiguration {
GitHubComponent component = new GitHubComponent();
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 GitHubComponentAutoConfiguration {
}
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<GitHubComponent> 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.github.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.github.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-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentAutoConfiguration.java
index cdc9cac..851a0e9 100644
--- a/platforms/spring-boot/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-google-calendar-starter/src/main/java/org/apache/camel/component/google/calendar/springboot/GoogleCalendarComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.google.calendar.GoogleCalendarComponent;
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 GoogleCalendarComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GoogleCalendarComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GoogleCalendarComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<GoogleCalendarComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private GoogleCalendarComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class GoogleCalendarComponentAutoConfiguration {
GoogleCalendarComponent component = new GoogleCalendarComponent();
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 GoogleCalendarComponentAutoConfiguration {
}
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<GoogleCalendarComponent> 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.google-calendar.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.google-calendar.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-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentAutoConfiguration.java
index c9643b7..062b4df 100644
--- a/platforms/spring-boot/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-google-drive-starter/src/main/java/org/apache/camel/component/google/drive/springboot/GoogleDriveComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.google.drive.GoogleDriveComponent;
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 GoogleDriveComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GoogleDriveComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GoogleDriveComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<GoogleDriveComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private GoogleDriveComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class GoogleDriveComponentAutoConfiguration {
GoogleDriveComponent component = new GoogleDriveComponent();
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 GoogleDriveComponentAutoConfiguration {
}
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<GoogleDriveComponent> 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.google-drive.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.google-drive.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-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentAutoConfiguration.java
index a78f345..86c25e4 100644
--- a/platforms/spring-boot/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-google-mail-starter/src/main/java/org/apache/camel/component/google/mail/springboot/GoogleMailComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.google.mail.GoogleMailComponent;
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 GoogleMailComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GoogleMailComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GoogleMailComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<GoogleMailComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private GoogleMailComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class GoogleMailComponentAutoConfiguration {
GoogleMailComponent component = new GoogleMailComponent();
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 GoogleMailComponentAutoConfiguration {
}
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<GoogleMailComponent> 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.google-mail.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.google-mail.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-google-pubsub-starter/src/main/java/org/apache/camel/component/google/pubsub/springboot/GooglePubsubComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-google-pubsub-starter/src/main/java/org/apache/camel/component/google/pubsub/springboot/GooglePubsubComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-google-pubsub-starter/src/main/java/org/apache/camel/component/google/pubsub/springboot/GooglePubsubComponentAutoConfiguration.java
index 9467826..aa8111e 100644
--- a/platforms/spring-boot/components-starter/camel-google-pubsub-starter/src/main/java/org/apache/camel/component/google/pubsub/springboot/GooglePubsubComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-google-pubsub-starter/src/main/java/org/apache/camel/component/google/pubsub/springboot/GooglePubsubComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.google.pubsub.GooglePubsubComponent;
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 GooglePubsubComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GooglePubsubComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GooglePubsubComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<GooglePubsubComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private GooglePubsubComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class GooglePubsubComponentAutoConfiguration {
GooglePubsubComponent component = new GooglePubsubComponent();
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 GooglePubsubComponentAutoConfiguration {
}
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<GooglePubsubComponent> 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.google-pubsub.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.google-pubsub.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-gora-starter/src/main/java/org/apache/camel/component/gora/springboot/GoraComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-gora-starter/src/main/java/org/apache/camel/component/gora/springboot/GoraComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-gora-starter/src/main/java/org/apache/camel/component/gora/springboot/GoraComponentAutoConfiguration.java
index fa0518c..ee4c859 100644
--- a/platforms/spring-boot/components-starter/camel-gora-starter/src/main/java/org/apache/camel/component/gora/springboot/GoraComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-gora-starter/src/main/java/org/apache/camel/component/gora/springboot/GoraComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.gora.GoraComponent;
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 GoraComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GoraComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GoraComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<GoraComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private GoraComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class GoraComponentAutoConfiguration {
GoraComponent component = new GoraComponent();
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 GoraComponentAutoConfiguration {
}
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<GoraComponent> 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.gora.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.gora.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-groovy-starter/src/main/java/org/apache/camel/language/groovy/springboot/GroovyLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-groovy-starter/src/main/java/org/apache/camel/language/groovy/springboot/GroovyLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-groovy-starter/src/main/java/org/apache/camel/language/groovy/springboot/GroovyLanguageAutoConfiguration.java
index 7f6869c..2093eba 100644
--- a/platforms/spring-boot/components-starter/camel-groovy-starter/src/main/java/org/apache/camel/language/groovy/springboot/GroovyLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-groovy-starter/src/main/java/org/apache/camel/language/groovy/springboot/GroovyLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.groovy.GroovyLanguage;
+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 GroovyLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GroovyLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GroovyLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<GroovyLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private GroovyLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class GroovyLanguageAutoConfiguration {
}
}
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<GroovyLanguage> 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.groovy.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.groovy.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-grpc-starter/src/main/java/org/apache/camel/component/grpc/springboot/GrpcComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-grpc-starter/src/main/java/org/apache/camel/component/grpc/springboot/GrpcComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-grpc-starter/src/main/java/org/apache/camel/component/grpc/springboot/GrpcComponentAutoConfiguration.java
index 9344c25..53a07fa 100644
--- a/platforms/spring-boot/components-starter/camel-grpc-starter/src/main/java/org/apache/camel/component/grpc/springboot/GrpcComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-grpc-starter/src/main/java/org/apache/camel/component/grpc/springboot/GrpcComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.grpc.GrpcComponent;
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 GrpcComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GrpcComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GrpcComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<GrpcComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private GrpcComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class GrpcComponentAutoConfiguration {
GrpcComponent component = new GrpcComponent();
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 GrpcComponentAutoConfiguration {
}
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<GrpcComponent> 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.grpc.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.grpc.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-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatAutoConfiguration.java
index 6b008e8..964f085 100644
--- a/platforms/spring-boot/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-gson-starter/src/main/java/org/apache/camel/component/gson/springboot/GsonDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.component.gson.GsonDataFormat;
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 GsonDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GsonDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GsonDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<GsonDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private GsonDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class GsonDataFormatAutoConfiguration {
}
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,27 @@ public class GsonDataFormatAutoConfiguration {
} 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<GsonDataFormat> 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.json-gson.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.json-gson.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-guava-eventbus-starter/src/main/java/org/apache/camel/component/guava/eventbus/springboot/GuavaEventBusComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-guava-eventbus-starter/src/main/java/org/apache/camel/component/guava/eventbus/springboot/GuavaEventBusComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-guava-eventbus-starter/src/main/java/org/apache/camel/component/guava/eventbus/springboot/GuavaEventBusComponentAutoConfiguration.java
index 7647d72..8f56850 100644
--- a/platforms/spring-boot/components-starter/camel-guava-eventbus-starter/src/main/java/org/apache/camel/component/guava/eventbus/springboot/GuavaEventBusComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-guava-eventbus-starter/src/main/java/org/apache/camel/component/guava/eventbus/springboot/GuavaEventBusComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.guava.eventbus.GuavaEventBusComponent;
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 GuavaEventBusComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GuavaEventBusComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GuavaEventBusComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<GuavaEventBusComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private GuavaEventBusComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class GuavaEventBusComponentAutoConfiguration {
GuavaEventBusComponent component = new GuavaEventBusComponent();
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 GuavaEventBusComponentAutoConfiguration {
}
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<GuavaEventBusComponent> 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.guava-eventbus.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.guava-eventbus.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/atomicnumber/springboot/HazelcastAtomicnumberComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/atomicnumber/springboot/HazelcastAtomicnumberComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/atomicnumber/springboot/HazelcastAtomicnumberComponentAutoConfiguration.java
index 1eb1a9f..9ec9945 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/atomicnumber/springboot/HazelcastAtomicnumberComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/atomicnumber/springboot/HazelcastAtomicnumberComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.atomicnumber.HazelcastAtomicnumberComponent;
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 HazelcastAtomicnumberComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastAtomicnumberComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastAtomicnumberComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastAtomicnumberComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastAtomicnumberComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastAtomicnumberComponentAutoConfiguration {
HazelcastAtomicnumberComponent component = new HazelcastAtomicnumberComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,24 @@ public class HazelcastAtomicnumberComponentAutoConfiguration {
}
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<HazelcastAtomicnumberComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator
+ .evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-atomicvalue.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-atomicvalue.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/instance/springboot/HazelcastInstanceComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/instance/springboot/HazelcastInstanceComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/instance/springboot/HazelcastInstanceComponentAutoConfiguration.java
index 2e65bc3..b008149 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/instance/springboot/HazelcastInstanceComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/instance/springboot/HazelcastInstanceComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.instance.HazelcastInstanceComponent;
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 HazelcastInstanceComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastInstanceComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastInstanceComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastInstanceComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastInstanceComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastInstanceComponentAutoConfiguration {
HazelcastInstanceComponent component = new HazelcastInstanceComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,24 @@ public class HazelcastInstanceComponentAutoConfiguration {
}
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<HazelcastInstanceComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator
+ .evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-instance.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-instance.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/list/springboot/HazelcastListComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/list/springboot/HazelcastListComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/list/springboot/HazelcastListComponentAutoConfiguration.java
index d10f2f2..9992dbb 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/list/springboot/HazelcastListComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/list/springboot/HazelcastListComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.list.HazelcastListComponent;
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 HazelcastListComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastListComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastListComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastListComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastListComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastListComponentAutoConfiguration {
HazelcastListComponent component = new HazelcastListComponent();
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 HazelcastListComponentAutoConfiguration {
}
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<HazelcastListComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-list.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-list.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/map/springboot/HazelcastMapComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/map/springboot/HazelcastMapComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/map/springboot/HazelcastMapComponentAutoConfiguration.java
index f33f69d..183d468 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/map/springboot/HazelcastMapComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/map/springboot/HazelcastMapComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.map.HazelcastMapComponent;
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 HazelcastMapComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastMapComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastMapComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastMapComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastMapComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastMapComponentAutoConfiguration {
HazelcastMapComponent component = new HazelcastMapComponent();
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 HazelcastMapComponentAutoConfiguration {
}
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<HazelcastMapComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-map.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-map.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/multimap/springboot/HazelcastMultimapComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/multimap/springboot/HazelcastMultimapComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/multimap/springboot/HazelcastMultimapComponentAutoConfiguration.java
index cd7cfef..8f2f2fc 100644
--- a/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/multimap/springboot/HazelcastMultimapComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-hazelcast-starter/src/main/java/org/apache/camel/component/hazelcast/multimap/springboot/HazelcastMultimapComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.hazelcast.multimap.HazelcastMultimapComponent;
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 HazelcastMultimapComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(HazelcastMultimapComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private HazelcastMultimapComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<HazelcastMultimapComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private HazelcastMultimapComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class HazelcastMultimapComponentAutoConfiguration {
HazelcastMultimapComponent component = new HazelcastMultimapComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,24 @@ public class HazelcastMultimapComponentAutoConfiguration {
}
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<HazelcastMultimapComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator
+ .evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-multimap.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.hazelcast-multimap.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
[14/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-elasticsearch-starter/src/main/java/org/apache/camel/component/elasticsearch/springboot/ElasticsearchComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-elasticsearch-starter/src/main/java/org/apache/camel/component/elasticsearch/springboot/ElasticsearchComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-elasticsearch-starter/src/main/java/org/apache/camel/component/elasticsearch/springboot/ElasticsearchComponentAutoConfiguration.java
index becb58a..6eeb755 100644
--- a/platforms/spring-boot/components-starter/camel-elasticsearch-starter/src/main/java/org/apache/camel/component/elasticsearch/springboot/ElasticsearchComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-elasticsearch-starter/src/main/java/org/apache/camel/component/elasticsearch/springboot/ElasticsearchComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.elasticsearch.ElasticsearchComponent;
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 ElasticsearchComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ElasticsearchComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ElasticsearchComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ElasticsearchComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ElasticsearchComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class ElasticsearchComponentAutoConfiguration {
ElasticsearchComponent component = new ElasticsearchComponent();
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 ElasticsearchComponentAutoConfiguration {
}
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<ElasticsearchComponent> 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.elasticsearch.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.elasticsearch.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-elasticsearch5-starter/src/main/java/org/apache/camel/component/elasticsearch5/springboot/ElasticsearchComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-elasticsearch5-starter/src/main/java/org/apache/camel/component/elasticsearch5/springboot/ElasticsearchComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-elasticsearch5-starter/src/main/java/org/apache/camel/component/elasticsearch5/springboot/ElasticsearchComponentAutoConfiguration.java
index fbc003e..fec84bd 100644
--- a/platforms/spring-boot/components-starter/camel-elasticsearch5-starter/src/main/java/org/apache/camel/component/elasticsearch5/springboot/ElasticsearchComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-elasticsearch5-starter/src/main/java/org/apache/camel/component/elasticsearch5/springboot/ElasticsearchComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.elasticsearch5.ElasticsearchComponent;
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 ElasticsearchComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ElasticsearchComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ElasticsearchComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ElasticsearchComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ElasticsearchComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class ElasticsearchComponentAutoConfiguration {
ElasticsearchComponent component = new ElasticsearchComponent();
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 ElasticsearchComponentAutoConfiguration {
}
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<ElasticsearchComponent> 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.elasticsearch5.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.elasticsearch5.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-elsql-starter/src/main/java/org/apache/camel/component/elsql/springboot/ElsqlComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-elsql-starter/src/main/java/org/apache/camel/component/elsql/springboot/ElsqlComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-elsql-starter/src/main/java/org/apache/camel/component/elsql/springboot/ElsqlComponentAutoConfiguration.java
index b9dd598..ef7c993 100644
--- a/platforms/spring-boot/components-starter/camel-elsql-starter/src/main/java/org/apache/camel/component/elsql/springboot/ElsqlComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-elsql-starter/src/main/java/org/apache/camel/component/elsql/springboot/ElsqlComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.elsql.ElsqlComponent;
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 ElsqlComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ElsqlComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ElsqlComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ElsqlComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ElsqlComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class ElsqlComponentAutoConfiguration {
ElsqlComponent component = new ElsqlComponent();
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 ElsqlComponentAutoConfiguration {
}
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<ElsqlComponent> 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.elsql.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.elsql.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-etcd-starter/src/main/java/org/apache/camel/component/etcd/springboot/EtcdComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-etcd-starter/src/main/java/org/apache/camel/component/etcd/springboot/EtcdComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-etcd-starter/src/main/java/org/apache/camel/component/etcd/springboot/EtcdComponentAutoConfiguration.java
index f077dea..7a454271 100644
--- a/platforms/spring-boot/components-starter/camel-etcd-starter/src/main/java/org/apache/camel/component/etcd/springboot/EtcdComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-etcd-starter/src/main/java/org/apache/camel/component/etcd/springboot/EtcdComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.etcd.EtcdComponent;
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 EtcdComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(EtcdComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private EtcdComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<EtcdComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private EtcdComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class EtcdComponentAutoConfiguration {
EtcdComponent component = new EtcdComponent();
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 EtcdComponentAutoConfiguration {
}
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<EtcdComponent> 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.etcd.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.etcd.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-exec-starter/src/main/java/org/apache/camel/component/exec/springboot/ExecComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-exec-starter/src/main/java/org/apache/camel/component/exec/springboot/ExecComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-exec-starter/src/main/java/org/apache/camel/component/exec/springboot/ExecComponentAutoConfiguration.java
index a264b40..4ff3b99 100644
--- a/platforms/spring-boot/components-starter/camel-exec-starter/src/main/java/org/apache/camel/component/exec/springboot/ExecComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-exec-starter/src/main/java/org/apache/camel/component/exec/springboot/ExecComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.exec.ExecComponent;
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 ExecComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ExecComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ExecComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ExecComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ExecComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class ExecComponentAutoConfiguration {
ExecComponent component = new ExecComponent();
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 ExecComponentAutoConfiguration {
}
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<ExecComponent> 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.exec.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.exec.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-facebook-starter/src/main/java/org/apache/camel/component/facebook/springboot/FacebookComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-facebook-starter/src/main/java/org/apache/camel/component/facebook/springboot/FacebookComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-facebook-starter/src/main/java/org/apache/camel/component/facebook/springboot/FacebookComponentAutoConfiguration.java
index d9d198b..1e25dba 100644
--- a/platforms/spring-boot/components-starter/camel-facebook-starter/src/main/java/org/apache/camel/component/facebook/springboot/FacebookComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-facebook-starter/src/main/java/org/apache/camel/component/facebook/springboot/FacebookComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.facebook.FacebookComponent;
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 FacebookComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(FacebookComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private FacebookComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<FacebookComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private FacebookComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class FacebookComponentAutoConfiguration {
FacebookComponent component = new FacebookComponent();
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 FacebookComponentAutoConfiguration {
}
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<FacebookComponent> 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.facebook.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.facebook.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-flatpack-starter/src/main/java/org/apache/camel/component/flatpack/springboot/FlatpackComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-flatpack-starter/src/main/java/org/apache/camel/component/flatpack/springboot/FlatpackComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-flatpack-starter/src/main/java/org/apache/camel/component/flatpack/springboot/FlatpackComponentAutoConfiguration.java
index 06aefb4..b38ab4f 100644
--- a/platforms/spring-boot/components-starter/camel-flatpack-starter/src/main/java/org/apache/camel/component/flatpack/springboot/FlatpackComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-flatpack-starter/src/main/java/org/apache/camel/component/flatpack/springboot/FlatpackComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.flatpack.FlatpackComponent;
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 FlatpackComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(FlatpackComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private FlatpackComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<FlatpackComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private FlatpackComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class FlatpackComponentAutoConfiguration {
FlatpackComponent component = new FlatpackComponent();
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 FlatpackComponentAutoConfiguration {
}
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<FlatpackComponent> 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.flatpack.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.flatpack.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-flatpack-starter/src/main/java/org/apache/camel/dataformat/flatpack/springboot/FlatpackDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-flatpack-starter/src/main/java/org/apache/camel/dataformat/flatpack/springboot/FlatpackDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-flatpack-starter/src/main/java/org/apache/camel/dataformat/flatpack/springboot/FlatpackDataFormatAutoConfiguration.java
index f5b9c0c..74e88d9 100644
--- a/platforms/spring-boot/components-starter/camel-flatpack-starter/src/main/java/org/apache/camel/dataformat/flatpack/springboot/FlatpackDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-flatpack-starter/src/main/java/org/apache/camel/dataformat/flatpack/springboot/FlatpackDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.flatpack.FlatpackDataFormat;
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 FlatpackDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(FlatpackDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private FlatpackDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<FlatpackDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private FlatpackDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class FlatpackDataFormatAutoConfiguration {
}
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 FlatpackDataFormatAutoConfiguration {
} 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<FlatpackDataFormat> 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.flatpack.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.flatpack.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-flink-starter/src/main/java/org/apache/camel/component/flink/springboot/FlinkComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-flink-starter/src/main/java/org/apache/camel/component/flink/springboot/FlinkComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-flink-starter/src/main/java/org/apache/camel/component/flink/springboot/FlinkComponentAutoConfiguration.java
index 51b6373..3ce27a0 100644
--- a/platforms/spring-boot/components-starter/camel-flink-starter/src/main/java/org/apache/camel/component/flink/springboot/FlinkComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-flink-starter/src/main/java/org/apache/camel/component/flink/springboot/FlinkComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.flink.FlinkComponent;
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 FlinkComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(FlinkComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private FlinkComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<FlinkComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private FlinkComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class FlinkComponentAutoConfiguration {
FlinkComponent component = new FlinkComponent();
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 FlinkComponentAutoConfiguration {
}
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<FlinkComponent> 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.flink.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.flink.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-fop-starter/src/main/java/org/apache/camel/component/fop/springboot/FopComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-fop-starter/src/main/java/org/apache/camel/component/fop/springboot/FopComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-fop-starter/src/main/java/org/apache/camel/component/fop/springboot/FopComponentAutoConfiguration.java
index 8cd173f..80dc45f 100644
--- a/platforms/spring-boot/components-starter/camel-fop-starter/src/main/java/org/apache/camel/component/fop/springboot/FopComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-fop-starter/src/main/java/org/apache/camel/component/fop/springboot/FopComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.fop.FopComponent;
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 FopComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(FopComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private FopComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<FopComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private FopComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class FopComponentAutoConfiguration {
FopComponent component = new FopComponent();
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 FopComponentAutoConfiguration {
}
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<FopComponent> 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.fop.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.fop.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-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentAutoConfiguration.java
index 0ce4d1c..45db512 100644
--- a/platforms/spring-boot/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-freemarker-starter/src/main/java/org/apache/camel/component/freemarker/springboot/FreemarkerComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.freemarker.FreemarkerComponent;
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 FreemarkerComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(FreemarkerComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private FreemarkerComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<FreemarkerComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private FreemarkerComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class FreemarkerComponentAutoConfiguration {
FreemarkerComponent component = new FreemarkerComponent();
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 FreemarkerComponentAutoConfiguration {
}
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<FreemarkerComponent> 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.freemarker.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.freemarker.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-ftp-starter/src/main/java/org/apache/camel/component/file/remote/springboot/FtpComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ftp-starter/src/main/java/org/apache/camel/component/file/remote/springboot/FtpComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ftp-starter/src/main/java/org/apache/camel/component/file/remote/springboot/FtpComponentAutoConfiguration.java
index f27b52f..fb994c1 100644
--- a/platforms/spring-boot/components-starter/camel-ftp-starter/src/main/java/org/apache/camel/component/file/remote/springboot/FtpComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ftp-starter/src/main/java/org/apache/camel/component/file/remote/springboot/FtpComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.file.remote.FtpComponent;
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 FtpComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(FtpComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private FtpComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<FtpComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private FtpComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class FtpComponentAutoConfiguration {
FtpComponent component = new FtpComponent();
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 FtpComponentAutoConfiguration {
}
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<FtpComponent> 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.ftp.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ftp.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-ftp-starter/src/main/java/org/apache/camel/component/file/remote/springboot/FtpsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ftp-starter/src/main/java/org/apache/camel/component/file/remote/springboot/FtpsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ftp-starter/src/main/java/org/apache/camel/component/file/remote/springboot/FtpsComponentAutoConfiguration.java
index 198c237..f9efafd 100644
--- a/platforms/spring-boot/components-starter/camel-ftp-starter/src/main/java/org/apache/camel/component/file/remote/springboot/FtpsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ftp-starter/src/main/java/org/apache/camel/component/file/remote/springboot/FtpsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.file.remote.FtpsComponent;
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 FtpsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(FtpsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private FtpsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<FtpsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private FtpsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class FtpsComponentAutoConfiguration {
FtpsComponent component = new FtpsComponent();
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 FtpsComponentAutoConfiguration {
}
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<FtpsComponent> 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.ftps.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ftps.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-ftp-starter/src/main/java/org/apache/camel/component/file/remote/springboot/SftpComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ftp-starter/src/main/java/org/apache/camel/component/file/remote/springboot/SftpComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ftp-starter/src/main/java/org/apache/camel/component/file/remote/springboot/SftpComponentAutoConfiguration.java
index 52ec1dc..12eaa2b 100644
--- a/platforms/spring-boot/components-starter/camel-ftp-starter/src/main/java/org/apache/camel/component/file/remote/springboot/SftpComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ftp-starter/src/main/java/org/apache/camel/component/file/remote/springboot/SftpComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.file.remote.SftpComponent;
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 SftpComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SftpComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SftpComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SftpComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SftpComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SftpComponentAutoConfiguration {
SftpComponent component = new SftpComponent();
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 SftpComponentAutoConfiguration {
}
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<SftpComponent> 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.sftp.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.sftp.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-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentAutoConfiguration.java
index ae0611e..73c6a61 100644
--- a/platforms/spring-boot/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ganglia-starter/src/main/java/org/apache/camel/component/ganglia/springboot/GangliaComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ganglia.GangliaComponent;
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 GangliaComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GangliaComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GangliaComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<GangliaComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private GangliaComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class GangliaComponentAutoConfiguration {
GangliaComponent component = new GangliaComponent();
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 GangliaComponentAutoConfiguration {
}
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<GangliaComponent> 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.ganglia.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ganglia.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-geocoder-starter/src/main/java/org/apache/camel/component/geocoder/springboot/GeoCoderComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-geocoder-starter/src/main/java/org/apache/camel/component/geocoder/springboot/GeoCoderComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-geocoder-starter/src/main/java/org/apache/camel/component/geocoder/springboot/GeoCoderComponentAutoConfiguration.java
index 5fca0ca..8471923 100644
--- a/platforms/spring-boot/components-starter/camel-geocoder-starter/src/main/java/org/apache/camel/component/geocoder/springboot/GeoCoderComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-geocoder-starter/src/main/java/org/apache/camel/component/geocoder/springboot/GeoCoderComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.geocoder.GeoCoderComponent;
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 GeoCoderComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GeoCoderComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GeoCoderComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<GeoCoderComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private GeoCoderComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class GeoCoderComponentAutoConfiguration {
GeoCoderComponent component = new GeoCoderComponent();
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 GeoCoderComponentAutoConfiguration {
}
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<GeoCoderComponent> 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.geocoder.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.geocoder.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
[04/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-soap-starter/src/main/java/org/apache/camel/dataformat/soap/springboot/SoapJaxbDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-soap-starter/src/main/java/org/apache/camel/dataformat/soap/springboot/SoapJaxbDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-soap-starter/src/main/java/org/apache/camel/dataformat/soap/springboot/SoapJaxbDataFormatAutoConfiguration.java
index 57f592b..9a213be 100644
--- a/platforms/spring-boot/components-starter/camel-soap-starter/src/main/java/org/apache/camel/dataformat/soap/springboot/SoapJaxbDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-soap-starter/src/main/java/org/apache/camel/dataformat/soap/springboot/SoapJaxbDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.soap.SoapJaxbDataFormat;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.DataFormatCustomizer;
import org.apache.camel.spi.DataFormatFactory;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.DataFormatConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -59,13 +62,13 @@ public class SoapJaxbDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SoapJaxbDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SoapJaxbDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<SoapJaxbDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private SoapJaxbDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class SoapJaxbDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,24 @@ public class SoapJaxbDataFormatAutoConfiguration {
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && dataformatConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (DataFormatCustomizer<SoapJaxbDataFormat> customizer : customizers) {
- LOGGER.debug(
- "Configure dataformat {}, with customizer {}",
- dataformat, customizer);
- customizer.customize(dataformat);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.soapjaxb.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.soapjaxb.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-solr-starter/src/main/java/org/apache/camel/component/solr/springboot/SolrComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-solr-starter/src/main/java/org/apache/camel/component/solr/springboot/SolrComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-solr-starter/src/main/java/org/apache/camel/component/solr/springboot/SolrComponentAutoConfiguration.java
index 28726ff..6ebf520 100644
--- a/platforms/spring-boot/components-starter/camel-solr-starter/src/main/java/org/apache/camel/component/solr/springboot/SolrComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-solr-starter/src/main/java/org/apache/camel/component/solr/springboot/SolrComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.solr.SolrComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class SolrComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SolrComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SolrComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SolrComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SolrComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SolrComponentAutoConfiguration {
SolrComponent component = new SolrComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class SolrComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<SolrComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.solr.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.solr.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-spark-starter/src/main/java/org/apache/camel/component/spark/springboot/SparkComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-spark-starter/src/main/java/org/apache/camel/component/spark/springboot/SparkComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spark-starter/src/main/java/org/apache/camel/component/spark/springboot/SparkComponentAutoConfiguration.java
index 875b3f0..5af7e20 100644
--- a/platforms/spring-boot/components-starter/camel-spark-starter/src/main/java/org/apache/camel/component/spark/springboot/SparkComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-spark-starter/src/main/java/org/apache/camel/component/spark/springboot/SparkComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.spark.SparkComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class SparkComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SparkComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SparkComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SparkComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SparkComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SparkComponentAutoConfiguration {
SparkComponent component = new SparkComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class SparkComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<SparkComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.spark.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.spark.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-splunk-starter/src/main/java/org/apache/camel/component/splunk/springboot/SplunkComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-splunk-starter/src/main/java/org/apache/camel/component/splunk/springboot/SplunkComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-splunk-starter/src/main/java/org/apache/camel/component/splunk/springboot/SplunkComponentAutoConfiguration.java
index 646635a..ba24f31 100644
--- a/platforms/spring-boot/components-starter/camel-splunk-starter/src/main/java/org/apache/camel/component/splunk/springboot/SplunkComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-splunk-starter/src/main/java/org/apache/camel/component/splunk/springboot/SplunkComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.splunk.SplunkComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class SplunkComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SplunkComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SplunkComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SplunkComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SplunkComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SplunkComponentAutoConfiguration {
SplunkComponent component = new SplunkComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class SplunkComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<SplunkComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.splunk.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.splunk.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-spring-batch-starter/src/main/java/org/apache/camel/component/spring/batch/springboot/SpringBatchComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-spring-batch-starter/src/main/java/org/apache/camel/component/spring/batch/springboot/SpringBatchComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-batch-starter/src/main/java/org/apache/camel/component/spring/batch/springboot/SpringBatchComponentAutoConfiguration.java
index b41fa6b..340f2bd 100644
--- a/platforms/spring-boot/components-starter/camel-spring-batch-starter/src/main/java/org/apache/camel/component/spring/batch/springboot/SpringBatchComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-spring-batch-starter/src/main/java/org/apache/camel/component/spring/batch/springboot/SpringBatchComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.spring.batch.SpringBatchComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class SpringBatchComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SpringBatchComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SpringBatchComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SpringBatchComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SpringBatchComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class SpringBatchComponentAutoConfiguration {
SpringBatchComponent component = new SpringBatchComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,23 @@ public class SpringBatchComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<SpringBatchComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.spring-batch.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.spring-batch.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentAutoConfiguration.java
index 931ae76..77cec19 100644
--- a/platforms/spring-boot/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.spring.integration.SpringIntegrationComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class SpringIntegrationComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SpringIntegrationComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SpringIntegrationComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SpringIntegrationComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SpringIntegrationComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class SpringIntegrationComponentAutoConfiguration {
SpringIntegrationComponent component = new SpringIntegrationComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,24 @@ public class SpringIntegrationComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<SpringIntegrationComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator
+ .evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.spring-integration.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.spring-integration.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentAutoConfiguration.java
index b38745e..c2bb0a7 100644
--- a/platforms/spring-boot/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.springldap.SpringLdapComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class SpringLdapComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SpringLdapComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SpringLdapComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SpringLdapComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SpringLdapComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SpringLdapComponentAutoConfiguration {
SpringLdapComponent component = new SpringLdapComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class SpringLdapComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<SpringLdapComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.spring-ldap.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.spring-ldap.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentAutoConfiguration.java
index dfda106..4a8866c 100644
--- a/platforms/spring-boot/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.redis.RedisComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class RedisComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(RedisComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private RedisComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<RedisComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private RedisComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class RedisComponentAutoConfiguration {
RedisComponent component = new RedisComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class RedisComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<RedisComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.spring-redis.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.spring-redis.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentAutoConfiguration.java
index 5913693..c3f5d11 100644
--- a/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.event.EventComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class EventComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(EventComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private EventComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<EventComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private EventComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class EventComponentAutoConfiguration {
EventComponent component = new EventComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class EventComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<EventComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.spring-event.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.spring-event.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/language/spel/springboot/SpelLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/language/spel/springboot/SpelLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/language/spel/springboot/SpelLanguageAutoConfiguration.java
index cfbcf52..eba482b 100644
--- a/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/language/spel/springboot/SpelLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/language/spel/springboot/SpelLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.spel.SpelLanguage;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spi.LanguageCustomizer;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.LanguageConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -38,6 +40,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -58,13 +61,13 @@ public class SpelLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SpelLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SpelLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<SpelLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private SpelLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class SpelLanguageAutoConfiguration {
}
}
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(languageConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), language, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && languageConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (LanguageCustomizer<SpelLanguage> customizer : customizers) {
- LOGGER.debug("Configure language {}, with customizer {}",
- language, customizer);
- customizer.customize(language);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.spel.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.spel.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure language {}, with customizer {}",
+ language, customizer);
+ customizer.customize(language);
+ }
}
}
return language;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentAutoConfiguration.java
index a1cf2f7..2303407 100644
--- a/platforms/spring-boot/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.spring.ws.SpringWebserviceComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class SpringWebserviceComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SpringWebserviceComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SpringWebserviceComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SpringWebserviceComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SpringWebserviceComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class SpringWebserviceComponentAutoConfiguration {
SpringWebserviceComponent component = new SpringWebserviceComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,23 @@ public class SpringWebserviceComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<SpringWebserviceComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.spring-ws.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.spring-ws.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentAutoConfiguration.java
index d860490..7002baa 100644
--- a/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.sql.SqlComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class SqlComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SqlComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SqlComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SqlComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SqlComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SqlComponentAutoConfiguration {
SqlComponent component = new SqlComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class SqlComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<SqlComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.sql.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.sql.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentAutoConfiguration.java
index de71837..81d8c78 100644
--- a/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.sql.stored.SqlStoredComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class SqlStoredComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SqlStoredComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SqlStoredComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SqlStoredComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SqlStoredComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SqlStoredComponentAutoConfiguration {
SqlStoredComponent component = new SqlStoredComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class SqlStoredComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<SqlStoredComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.sql-stored.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.sql-stored.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentAutoConfiguration.java
index 7d380c2..4910975 100644
--- a/platforms/spring-boot/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ssh.SshComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class SshComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SshComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SshComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SshComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SshComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SshComponentAutoConfiguration {
SshComponent component = new SshComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class SshComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<SshComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ssh.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ssh.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentAutoConfiguration.java
index 02003c1..a07f730 100644
--- a/platforms/spring-boot/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.stax.StAXComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class StAXComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(StAXComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private StAXComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<StAXComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private StAXComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class StAXComponentAutoConfiguration {
StAXComponent component = new StAXComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class StAXComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<StAXComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.stax.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.stax.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentAutoConfiguration.java
index c493428..665aac3 100644
--- a/platforms/spring-boot/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.stomp.StompComponent;
import org.apache.camel.spi.ComponentCustomizer;
+import org.apache.camel.spi.HasId;
import org.apache.camel.spring.boot.CamelAutoConfiguration;
import org.apache.camel.spring.boot.ComponentConfigurationProperties;
import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans;
import org.apache.camel.spring.boot.util.GroupCondition;
+import org.apache.camel.spring.boot.util.HierarchicalPropertiesEvaluator;
import org.apache.camel.util.IntrospectionSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
@@ -36,6 +38,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@@ -56,13 +59,13 @@ public class StompComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(StompComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private StompComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<StompComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private StompComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class StompComponentAutoConfiguration {
StompComponent component = new StompComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -101,14 +104,23 @@ public class StompComponentAutoConfiguration {
}
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), component, parameters);
- boolean useCustomizers = globalConfiguration.getCustomizer()
- .isEnabled()
- && componentConfiguration.getCustomizer().isEnabled();
- if (useCustomizers && ObjectHelper.isNotEmpty(customizers)) {
+ if (ObjectHelper.isNotEmpty(customizers)) {
for (ComponentCustomizer<StompComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.stomp.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.stomp.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
[05/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
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/language/xquery/springboot/XQueryLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-saxon-starter/src/main/java/org/apache/camel/language/xquery/springboot/XQueryLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-saxon-starter/src/main/java/org/apache/camel/language/xquery/springboot/XQueryLanguageAutoConfiguration.java
index cd18ed7..b46c08c 100644
--- a/platforms/spring-boot/components-starter/camel-saxon-starter/src/main/java/org/apache/camel/language/xquery/springboot/XQueryLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-saxon-starter/src/main/java/org/apache/camel/language/xquery/springboot/XQueryLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.xquery.XQueryLanguage;
+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 XQueryLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(XQueryLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private XQueryLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<XQueryLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private XQueryLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class XQueryLanguageAutoConfiguration {
}
}
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<XQueryLanguage> 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.xquery.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.xquery.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-schematron-starter/src/main/java/org/apache/camel/component/schematron/springboot/SchematronComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-schematron-starter/src/main/java/org/apache/camel/component/schematron/springboot/SchematronComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-schematron-starter/src/main/java/org/apache/camel/component/schematron/springboot/SchematronComponentAutoConfiguration.java
index 5b7831e..b406e88 100644
--- a/platforms/spring-boot/components-starter/camel-schematron-starter/src/main/java/org/apache/camel/component/schematron/springboot/SchematronComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-schematron-starter/src/main/java/org/apache/camel/component/schematron/springboot/SchematronComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.schematron.SchematronComponent;
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 SchematronComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SchematronComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SchematronComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SchematronComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SchematronComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SchematronComponentAutoConfiguration {
SchematronComponent component = new SchematronComponent();
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 SchematronComponentAutoConfiguration {
}
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<SchematronComponent> 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.schematron.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.schematron.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-script-starter/src/main/java/org/apache/camel/builder/script/springboot/JavaScriptLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/JavaScriptLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/JavaScriptLanguageAutoConfiguration.java
index ebd9b83..650cd37 100644
--- a/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/JavaScriptLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/JavaScriptLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.builder.script.JavaScriptLanguage;
+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 JavaScriptLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JavaScriptLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JavaScriptLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<JavaScriptLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private JavaScriptLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class JavaScriptLanguageAutoConfiguration {
}
}
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<JavaScriptLanguage> 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.javascript.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.javascript.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-script-starter/src/main/java/org/apache/camel/builder/script/springboot/PhpLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/PhpLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/PhpLanguageAutoConfiguration.java
index 7b24d10..09915d9 100644
--- a/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/PhpLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/PhpLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.builder.script.PhpLanguage;
+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 PhpLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(PhpLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private PhpLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<PhpLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private PhpLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class PhpLanguageAutoConfiguration {
}
}
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<PhpLanguage> 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.php.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.php.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-script-starter/src/main/java/org/apache/camel/builder/script/springboot/PythonLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/PythonLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/PythonLanguageAutoConfiguration.java
index e7387fd..24dd98b 100644
--- a/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/PythonLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/PythonLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.builder.script.PythonLanguage;
+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 PythonLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(PythonLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private PythonLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<PythonLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private PythonLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class PythonLanguageAutoConfiguration {
}
}
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<PythonLanguage> 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.python.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.python.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-script-starter/src/main/java/org/apache/camel/builder/script/springboot/RubyLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/RubyLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/RubyLanguageAutoConfiguration.java
index ef9afb1..d4ef6d3 100644
--- a/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/RubyLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-script-starter/src/main/java/org/apache/camel/builder/script/springboot/RubyLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.builder.script.RubyLanguage;
+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 RubyLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(RubyLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private RubyLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<RubyLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private RubyLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class RubyLanguageAutoConfiguration {
}
}
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<RubyLanguage> 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.ruby.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.ruby.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-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentAutoConfiguration.java
index 57aa489..3687983 100644
--- a/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.servicenow.ServiceNowComponent;
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 ServiceNowComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ServiceNowComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ServiceNowComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ServiceNowComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ServiceNowComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class ServiceNowComponentAutoConfiguration {
ServiceNowComponent component = new ServiceNowComponent();
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 ServiceNowComponentAutoConfiguration {
}
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<ServiceNowComponent> 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.servicenow.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.servicenow.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-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletComponentAutoConfiguration.java
index 500c419..70c37c2 100644
--- a/platforms/spring-boot/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.servlet.ServletComponent;
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 ServletComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ServletComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ServletComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ServletComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ServletComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class ServletComponentAutoConfiguration {
ServletComponent component = new ServletComponent();
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 ServletComponentAutoConfiguration {
}
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<ServletComponent> 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.servlet.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.servlet.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-sip-starter/src/main/java/org/apache/camel/component/sip/springboot/SipComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-sip-starter/src/main/java/org/apache/camel/component/sip/springboot/SipComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-sip-starter/src/main/java/org/apache/camel/component/sip/springboot/SipComponentAutoConfiguration.java
index 96e9329..2c5ae4b 100644
--- a/platforms/spring-boot/components-starter/camel-sip-starter/src/main/java/org/apache/camel/component/sip/springboot/SipComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-sip-starter/src/main/java/org/apache/camel/component/sip/springboot/SipComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.sip.SipComponent;
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 SipComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SipComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SipComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SipComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SipComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SipComponentAutoConfiguration {
SipComponent component = new SipComponent();
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 SipComponentAutoConfiguration {
}
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<SipComponent> 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.sip.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.sip.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-sjms-starter/src/main/java/org/apache/camel/component/sjms/batch/springboot/SjmsBatchComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/batch/springboot/SjmsBatchComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/batch/springboot/SjmsBatchComponentAutoConfiguration.java
index 5844e7c..e42c4b6 100644
--- a/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/batch/springboot/SjmsBatchComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/batch/springboot/SjmsBatchComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.sjms.batch.SjmsBatchComponent;
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 SjmsBatchComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SjmsBatchComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SjmsBatchComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SjmsBatchComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SjmsBatchComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SjmsBatchComponentAutoConfiguration {
SjmsBatchComponent component = new SjmsBatchComponent();
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 SjmsBatchComponentAutoConfiguration {
}
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<SjmsBatchComponent> 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.sjms-batch.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.sjms-batch.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/springboot/SjmsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/springboot/SjmsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/springboot/SjmsComponentAutoConfiguration.java
index ea9645d..88b8915 100644
--- a/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/springboot/SjmsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/springboot/SjmsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.sjms.SjmsComponent;
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 SjmsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SjmsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SjmsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SjmsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SjmsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SjmsComponentAutoConfiguration {
SjmsComponent component = new SjmsComponent();
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 SjmsComponentAutoConfiguration {
}
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<SjmsComponent> 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.sjms.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.sjms.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-sjms2-starter/src/main/java/org/apache/camel/component/sjms2/springboot/Sjms2ComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-sjms2-starter/src/main/java/org/apache/camel/component/sjms2/springboot/Sjms2ComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-sjms2-starter/src/main/java/org/apache/camel/component/sjms2/springboot/Sjms2ComponentAutoConfiguration.java
index 99859e5..49d3eca 100644
--- a/platforms/spring-boot/components-starter/camel-sjms2-starter/src/main/java/org/apache/camel/component/sjms2/springboot/Sjms2ComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-sjms2-starter/src/main/java/org/apache/camel/component/sjms2/springboot/Sjms2ComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.sjms2.Sjms2Component;
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 Sjms2ComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(Sjms2ComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private Sjms2ComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<Sjms2Component>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private Sjms2ComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class Sjms2ComponentAutoConfiguration {
Sjms2Component component = new Sjms2Component();
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 Sjms2ComponentAutoConfiguration {
}
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<Sjms2Component> 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.sjms2.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.sjms2.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-slack-starter/src/main/java/org/apache/camel/component/slack/springboot/SlackComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-slack-starter/src/main/java/org/apache/camel/component/slack/springboot/SlackComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-slack-starter/src/main/java/org/apache/camel/component/slack/springboot/SlackComponentAutoConfiguration.java
index abb0aa6..bf58346 100644
--- a/platforms/spring-boot/components-starter/camel-slack-starter/src/main/java/org/apache/camel/component/slack/springboot/SlackComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-slack-starter/src/main/java/org/apache/camel/component/slack/springboot/SlackComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.slack.SlackComponent;
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 SlackComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SlackComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SlackComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SlackComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SlackComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SlackComponentAutoConfiguration {
SlackComponent component = new SlackComponent();
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 SlackComponentAutoConfiguration {
}
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<SlackComponent> 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.slack.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.slack.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-smpp-starter/src/main/java/org/apache/camel/component/smpp/springboot/SmppComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-smpp-starter/src/main/java/org/apache/camel/component/smpp/springboot/SmppComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-smpp-starter/src/main/java/org/apache/camel/component/smpp/springboot/SmppComponentAutoConfiguration.java
index cf710f8..29cd1ea 100644
--- a/platforms/spring-boot/components-starter/camel-smpp-starter/src/main/java/org/apache/camel/component/smpp/springboot/SmppComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-smpp-starter/src/main/java/org/apache/camel/component/smpp/springboot/SmppComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.smpp.SmppComponent;
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 SmppComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SmppComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SmppComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SmppComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SmppComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SmppComponentAutoConfiguration {
SmppComponent component = new SmppComponent();
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 SmppComponentAutoConfiguration {
}
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<SmppComponent> 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.smpp.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.smpp.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-snakeyaml-starter/src/main/java/org/apache/camel/component/snakeyaml/springboot/SnakeYAMLDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-snakeyaml-starter/src/main/java/org/apache/camel/component/snakeyaml/springboot/SnakeYAMLDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-snakeyaml-starter/src/main/java/org/apache/camel/component/snakeyaml/springboot/SnakeYAMLDataFormatAutoConfiguration.java
index 01d530a..9c107bb 100644
--- a/platforms/spring-boot/components-starter/camel-snakeyaml-starter/src/main/java/org/apache/camel/component/snakeyaml/springboot/SnakeYAMLDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-snakeyaml-starter/src/main/java/org/apache/camel/component/snakeyaml/springboot/SnakeYAMLDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.component.snakeyaml.SnakeYAMLDataFormat;
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 SnakeYAMLDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SnakeYAMLDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SnakeYAMLDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<SnakeYAMLDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private SnakeYAMLDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class SnakeYAMLDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,19 +102,31 @@ public class SnakeYAMLDataFormatAutoConfiguration {
} 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<SnakeYAMLDataFormat> 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.yaml-snakeyaml.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.yaml-snakeyaml.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
}
};
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-snmp-starter/src/main/java/org/apache/camel/component/snmp/springboot/SnmpComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-snmp-starter/src/main/java/org/apache/camel/component/snmp/springboot/SnmpComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-snmp-starter/src/main/java/org/apache/camel/component/snmp/springboot/SnmpComponentAutoConfiguration.java
index 8dfd1ad..5519b9a 100644
--- a/platforms/spring-boot/components-starter/camel-snmp-starter/src/main/java/org/apache/camel/component/snmp/springboot/SnmpComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-snmp-starter/src/main/java/org/apache/camel/component/snmp/springboot/SnmpComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.snmp.SnmpComponent;
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 SnmpComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SnmpComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SnmpComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SnmpComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SnmpComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SnmpComponentAutoConfiguration {
SnmpComponent component = new SnmpComponent();
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 SnmpComponentAutoConfiguration {
}
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<SnmpComponent> 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.snmp.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.snmp.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
[11/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/cache/springboot/IgniteCacheComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/cache/springboot/IgniteCacheComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/cache/springboot/IgniteCacheComponentAutoConfiguration.java
index 7130582..9d4b849 100644
--- a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/cache/springboot/IgniteCacheComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/cache/springboot/IgniteCacheComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ignite.cache.IgniteCacheComponent;
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 IgniteCacheComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(IgniteCacheComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private IgniteCacheComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<IgniteCacheComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private IgniteCacheComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class IgniteCacheComponentAutoConfiguration {
IgniteCacheComponent component = new IgniteCacheComponent();
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 IgniteCacheComponentAutoConfiguration {
}
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<IgniteCacheComponent> 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.ignite-cache.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ignite-cache.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/compute/springboot/IgniteComputeComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/compute/springboot/IgniteComputeComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/compute/springboot/IgniteComputeComponentAutoConfiguration.java
index 0fb6703..65d8a9b 100644
--- a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/compute/springboot/IgniteComputeComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/compute/springboot/IgniteComputeComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ignite.compute.IgniteComputeComponent;
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 IgniteComputeComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(IgniteComputeComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private IgniteComputeComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<IgniteComputeComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private IgniteComputeComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class IgniteComputeComponentAutoConfiguration {
IgniteComputeComponent component = new IgniteComputeComponent();
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 IgniteComputeComponentAutoConfiguration {
}
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<IgniteComputeComponent> 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.ignite-compute.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ignite-compute.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-ignite-starter/src/main/java/org/apache/camel/component/ignite/events/springboot/IgniteEventsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/events/springboot/IgniteEventsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/events/springboot/IgniteEventsComponentAutoConfiguration.java
index 4735ac8..b2aac4d 100644
--- a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/events/springboot/IgniteEventsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/events/springboot/IgniteEventsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ignite.events.IgniteEventsComponent;
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 IgniteEventsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(IgniteEventsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private IgniteEventsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<IgniteEventsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private IgniteEventsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class IgniteEventsComponentAutoConfiguration {
IgniteEventsComponent component = new IgniteEventsComponent();
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 IgniteEventsComponentAutoConfiguration {
}
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<IgniteEventsComponent> 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.ignite-events.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ignite-events.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-ignite-starter/src/main/java/org/apache/camel/component/ignite/idgen/springboot/IgniteIdGenComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/idgen/springboot/IgniteIdGenComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/idgen/springboot/IgniteIdGenComponentAutoConfiguration.java
index fc5a067..9d41111 100644
--- a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/idgen/springboot/IgniteIdGenComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/idgen/springboot/IgniteIdGenComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ignite.idgen.IgniteIdGenComponent;
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 IgniteIdGenComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(IgniteIdGenComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private IgniteIdGenComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<IgniteIdGenComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private IgniteIdGenComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class IgniteIdGenComponentAutoConfiguration {
IgniteIdGenComponent component = new IgniteIdGenComponent();
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 IgniteIdGenComponentAutoConfiguration {
}
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<IgniteIdGenComponent> 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.ignite-idgen.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ignite-idgen.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-ignite-starter/src/main/java/org/apache/camel/component/ignite/messaging/springboot/IgniteMessagingComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/messaging/springboot/IgniteMessagingComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/messaging/springboot/IgniteMessagingComponentAutoConfiguration.java
index 3b241b1..01d041d 100644
--- a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/messaging/springboot/IgniteMessagingComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/messaging/springboot/IgniteMessagingComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ignite.messaging.IgniteMessagingComponent;
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 IgniteMessagingComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(IgniteMessagingComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private IgniteMessagingComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<IgniteMessagingComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private IgniteMessagingComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class IgniteMessagingComponentAutoConfiguration {
IgniteMessagingComponent component = new IgniteMessagingComponent();
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 IgniteMessagingComponentAutoConfiguration {
}
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<IgniteMessagingComponent> 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.ignite-messaging.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ignite-messaging.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-ignite-starter/src/main/java/org/apache/camel/component/ignite/queue/springboot/IgniteQueueComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/queue/springboot/IgniteQueueComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/queue/springboot/IgniteQueueComponentAutoConfiguration.java
index a8ebd04..fe21b4f 100644
--- a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/queue/springboot/IgniteQueueComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/queue/springboot/IgniteQueueComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ignite.queue.IgniteQueueComponent;
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 IgniteQueueComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(IgniteQueueComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private IgniteQueueComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<IgniteQueueComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private IgniteQueueComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class IgniteQueueComponentAutoConfiguration {
IgniteQueueComponent component = new IgniteQueueComponent();
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 IgniteQueueComponentAutoConfiguration {
}
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<IgniteQueueComponent> 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.ignite-queue.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ignite-queue.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/set/springboot/IgniteSetComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/set/springboot/IgniteSetComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/set/springboot/IgniteSetComponentAutoConfiguration.java
index 073b3fc..4947029 100644
--- a/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/set/springboot/IgniteSetComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ignite-starter/src/main/java/org/apache/camel/component/ignite/set/springboot/IgniteSetComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ignite.set.IgniteSetComponent;
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 IgniteSetComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(IgniteSetComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private IgniteSetComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<IgniteSetComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private IgniteSetComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class IgniteSetComponentAutoConfiguration {
IgniteSetComponent component = new IgniteSetComponent();
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 IgniteSetComponentAutoConfiguration {
}
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<IgniteSetComponent> 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.ignite-set.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ignite-set.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-infinispan-starter/src/main/java/org/apache/camel/component/infinispan/springboot/InfinispanComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-infinispan-starter/src/main/java/org/apache/camel/component/infinispan/springboot/InfinispanComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-infinispan-starter/src/main/java/org/apache/camel/component/infinispan/springboot/InfinispanComponentAutoConfiguration.java
index 85344c6..53d5fc5 100644
--- a/platforms/spring-boot/components-starter/camel-infinispan-starter/src/main/java/org/apache/camel/component/infinispan/springboot/InfinispanComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-infinispan-starter/src/main/java/org/apache/camel/component/infinispan/springboot/InfinispanComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.infinispan.InfinispanComponent;
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 InfinispanComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(InfinispanComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private InfinispanComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<InfinispanComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private InfinispanComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class InfinispanComponentAutoConfiguration {
InfinispanComponent component = new InfinispanComponent();
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 InfinispanComponentAutoConfiguration {
}
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<InfinispanComponent> 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.infinispan.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.infinispan.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-influxdb-starter/src/main/java/org/apache/camel/component/influxdb/springboot/InfluxDbComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-influxdb-starter/src/main/java/org/apache/camel/component/influxdb/springboot/InfluxDbComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-influxdb-starter/src/main/java/org/apache/camel/component/influxdb/springboot/InfluxDbComponentAutoConfiguration.java
index 6e0dba6..5e071f7 100644
--- a/platforms/spring-boot/components-starter/camel-influxdb-starter/src/main/java/org/apache/camel/component/influxdb/springboot/InfluxDbComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-influxdb-starter/src/main/java/org/apache/camel/component/influxdb/springboot/InfluxDbComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.influxdb.InfluxDbComponent;
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 InfluxDbComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(InfluxDbComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private InfluxDbComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<InfluxDbComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private InfluxDbComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class InfluxDbComponentAutoConfiguration {
InfluxDbComponent component = new InfluxDbComponent();
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 InfluxDbComponentAutoConfiguration {
}
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<InfluxDbComponent> 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.influxdb.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.influxdb.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-irc-starter/src/main/java/org/apache/camel/component/irc/springboot/IrcComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-irc-starter/src/main/java/org/apache/camel/component/irc/springboot/IrcComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-irc-starter/src/main/java/org/apache/camel/component/irc/springboot/IrcComponentAutoConfiguration.java
index 21bfd84..390aa6e 100644
--- a/platforms/spring-boot/components-starter/camel-irc-starter/src/main/java/org/apache/camel/component/irc/springboot/IrcComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-irc-starter/src/main/java/org/apache/camel/component/irc/springboot/IrcComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.irc.IrcComponent;
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 IrcComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(IrcComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private IrcComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<IrcComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private IrcComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class IrcComponentAutoConfiguration {
IrcComponent component = new IrcComponent();
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 IrcComponentAutoConfiguration {
}
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<IrcComponent> 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.irc.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.irc.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-ironmq-starter/src/main/java/org/apache/camel/component/ironmq/springboot/IronMQComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ironmq-starter/src/main/java/org/apache/camel/component/ironmq/springboot/IronMQComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ironmq-starter/src/main/java/org/apache/camel/component/ironmq/springboot/IronMQComponentAutoConfiguration.java
index a6512ce..54faa14 100644
--- a/platforms/spring-boot/components-starter/camel-ironmq-starter/src/main/java/org/apache/camel/component/ironmq/springboot/IronMQComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ironmq-starter/src/main/java/org/apache/camel/component/ironmq/springboot/IronMQComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ironmq.IronMQComponent;
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 IronMQComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(IronMQComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private IronMQComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<IronMQComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private IronMQComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class IronMQComponentAutoConfiguration {
IronMQComponent component = new IronMQComponent();
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 IronMQComponentAutoConfiguration {
}
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<IronMQComponent> 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.ironmq.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.ironmq.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-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatAutoConfiguration.java
index e5d3222..bdb36e9 100644
--- a/platforms/spring-boot/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jackson-starter/src/main/java/org/apache/camel/component/jackson/springboot/JacksonDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.component.jackson.JacksonDataFormat;
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 JacksonDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JacksonDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JacksonDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<JacksonDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private JacksonDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class JacksonDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,27 @@ public class JacksonDataFormatAutoConfiguration {
} 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<JacksonDataFormat> 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.json-jackson.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.json-jackson.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-jacksonxml-starter/src/main/java/org/apache/camel/component/jacksonxml/springboot/JacksonXMLDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jacksonxml-starter/src/main/java/org/apache/camel/component/jacksonxml/springboot/JacksonXMLDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jacksonxml-starter/src/main/java/org/apache/camel/component/jacksonxml/springboot/JacksonXMLDataFormatAutoConfiguration.java
index 1e115aa..2452f42 100644
--- a/platforms/spring-boot/components-starter/camel-jacksonxml-starter/src/main/java/org/apache/camel/component/jacksonxml/springboot/JacksonXMLDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jacksonxml-starter/src/main/java/org/apache/camel/component/jacksonxml/springboot/JacksonXMLDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.component.jacksonxml.JacksonXMLDataFormat;
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 JacksonXMLDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JacksonXMLDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JacksonXMLDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<JacksonXMLDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private JacksonXMLDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class JacksonXMLDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,27 @@ public class JacksonXMLDataFormatAutoConfiguration {
} 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<JacksonXMLDataFormat> 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.jacksonxml.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.jacksonxml.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-javaspace-starter/src/main/java/org/apache/camel/component/javaspace/springboot/JavaSpaceComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-javaspace-starter/src/main/java/org/apache/camel/component/javaspace/springboot/JavaSpaceComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-javaspace-starter/src/main/java/org/apache/camel/component/javaspace/springboot/JavaSpaceComponentAutoConfiguration.java
index 90b6ce3..0601024 100644
--- a/platforms/spring-boot/components-starter/camel-javaspace-starter/src/main/java/org/apache/camel/component/javaspace/springboot/JavaSpaceComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-javaspace-starter/src/main/java/org/apache/camel/component/javaspace/springboot/JavaSpaceComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.javaspace.JavaSpaceComponent;
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 JavaSpaceComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JavaSpaceComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JavaSpaceComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<JavaSpaceComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private JavaSpaceComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class JavaSpaceComponentAutoConfiguration {
JavaSpaceComponent component = new JavaSpaceComponent();
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 JavaSpaceComponentAutoConfiguration {
}
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<JavaSpaceComponent> 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.javaspace.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.javaspace.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-jaxb-starter/src/main/java/org/apache/camel/converter/jaxb/springboot/JaxbDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jaxb-starter/src/main/java/org/apache/camel/converter/jaxb/springboot/JaxbDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jaxb-starter/src/main/java/org/apache/camel/converter/jaxb/springboot/JaxbDataFormatAutoConfiguration.java
index 0f7f2de..455ace1 100644
--- a/platforms/spring-boot/components-starter/camel-jaxb-starter/src/main/java/org/apache/camel/converter/jaxb/springboot/JaxbDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jaxb-starter/src/main/java/org/apache/camel/converter/jaxb/springboot/JaxbDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.converter.jaxb.JaxbDataFormat;
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 JaxbDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JaxbDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JaxbDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<JaxbDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private JaxbDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class JaxbDataFormatAutoConfiguration {
}
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 JaxbDataFormatAutoConfiguration {
} 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<JaxbDataFormat> 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.jaxb.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.jaxb.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-jbpm-starter/src/main/java/org/apache/camel/component/jbpm/springboot/JBPMComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jbpm-starter/src/main/java/org/apache/camel/component/jbpm/springboot/JBPMComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jbpm-starter/src/main/java/org/apache/camel/component/jbpm/springboot/JBPMComponentAutoConfiguration.java
index 6f29dda..87f57bb 100644
--- a/platforms/spring-boot/components-starter/camel-jbpm-starter/src/main/java/org/apache/camel/component/jbpm/springboot/JBPMComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jbpm-starter/src/main/java/org/apache/camel/component/jbpm/springboot/JBPMComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.jbpm.JBPMComponent;
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 JBPMComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JBPMComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JBPMComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<JBPMComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private JBPMComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class JBPMComponentAutoConfiguration {
JBPMComponent component = new JBPMComponent();
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 JBPMComponentAutoConfiguration {
}
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<JBPMComponent> 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.jbpm.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.jbpm.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
[07/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentAutoConfiguration.java
index 1d1cba4..e3ec8e7 100644
--- a/platforms/spring-boot/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-netty4-http-starter/src/main/java/org/apache/camel/component/netty4/http/springboot/NettyHttpComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.netty4.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.netty4-http.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.netty4-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-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentAutoConfiguration.java
index 2e27d79..a415f70 100644
--- a/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.netty4.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.netty4.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.netty4.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-ognl-starter/src/main/java/org/apache/camel/language/ognl/springboot/OgnlLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ognl-starter/src/main/java/org/apache/camel/language/ognl/springboot/OgnlLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-ognl-starter/src/main/java/org/apache/camel/language/ognl/springboot/OgnlLanguageAutoConfiguration.java
index 8d3954e..c09824d 100644
--- a/platforms/spring-boot/components-starter/camel-ognl-starter/src/main/java/org/apache/camel/language/ognl/springboot/OgnlLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ognl-starter/src/main/java/org/apache/camel/language/ognl/springboot/OgnlLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.ognl.OgnlLanguage;
+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 OgnlLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(OgnlLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private OgnlLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<OgnlLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private OgnlLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class OgnlLanguageAutoConfiguration {
}
}
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<OgnlLanguage> 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.ognl.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.ognl.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-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentAutoConfiguration.java
index 4c59541..33032cf 100644
--- a/platforms/spring-boot/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-olingo2-starter/src/main/java/org/apache/camel/component/olingo2/springboot/Olingo2ComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.olingo2.Olingo2Component;
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 Olingo2ComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(Olingo2ComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private Olingo2ComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<Olingo2Component>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private Olingo2ComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class Olingo2ComponentAutoConfiguration {
Olingo2Component component = new Olingo2Component();
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 Olingo2ComponentAutoConfiguration {
}
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<Olingo2Component> 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.olingo2.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.olingo2.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-olingo4-starter/src/main/java/org/apache/camel/component/olingo4/springboot/Olingo4ComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-olingo4-starter/src/main/java/org/apache/camel/component/olingo4/springboot/Olingo4ComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-olingo4-starter/src/main/java/org/apache/camel/component/olingo4/springboot/Olingo4ComponentAutoConfiguration.java
index 354bf87..b261cf1 100644
--- a/platforms/spring-boot/components-starter/camel-olingo4-starter/src/main/java/org/apache/camel/component/olingo4/springboot/Olingo4ComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-olingo4-starter/src/main/java/org/apache/camel/component/olingo4/springboot/Olingo4ComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.olingo4.Olingo4Component;
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 Olingo4ComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(Olingo4ComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private Olingo4ComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<Olingo4Component>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private Olingo4ComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class Olingo4ComponentAutoConfiguration {
Olingo4Component component = new Olingo4Component();
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 Olingo4ComponentAutoConfiguration {
}
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<Olingo4Component> 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.olingo4.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.olingo4.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-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentAutoConfiguration.java
index bd20eeb..2526982 100644
--- a/platforms/spring-boot/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openshift-starter/src/main/java/org/apache/camel/component/openshift/springboot/OpenShiftComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openshift.OpenShiftComponent;
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 OpenShiftComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(OpenShiftComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private OpenShiftComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<OpenShiftComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private OpenShiftComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class OpenShiftComponentAutoConfiguration {
OpenShiftComponent component = new OpenShiftComponent();
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 OpenShiftComponentAutoConfiguration {
}
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<OpenShiftComponent> 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.openshift.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openshift.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-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentAutoConfiguration.java
index 318dea9..2a05b60 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/cinder/springboot/CinderComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.cinder.CinderComponent;
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 CinderComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CinderComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CinderComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<CinderComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private CinderComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class CinderComponentAutoConfiguration {
CinderComponent component = new CinderComponent();
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 CinderComponentAutoConfiguration {
}
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<CinderComponent> 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.openstack-cinder.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-cinder.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-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentAutoConfiguration.java
index b8a5e93..a158f59 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/glance/springboot/GlanceComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.glance.GlanceComponent;
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 GlanceComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(GlanceComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private GlanceComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<GlanceComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private GlanceComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class GlanceComponentAutoConfiguration {
GlanceComponent component = new GlanceComponent();
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 GlanceComponentAutoConfiguration {
}
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<GlanceComponent> 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.openstack-glance.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-glance.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-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentAutoConfiguration.java
index b489575..8cfa07f 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/keystone/springboot/KeystoneComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.keystone.KeystoneComponent;
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 KeystoneComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(KeystoneComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private KeystoneComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<KeystoneComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private KeystoneComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class KeystoneComponentAutoConfiguration {
KeystoneComponent component = new KeystoneComponent();
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,24 @@ public class KeystoneComponentAutoConfiguration {
}
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<KeystoneComponent> 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.openstack-keystone.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-keystone.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-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentAutoConfiguration.java
index 48e2ef0..ef2fb78 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/neutron/springboot/NeutronComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.neutron.NeutronComponent;
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 NeutronComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(NeutronComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private NeutronComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<NeutronComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private NeutronComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class NeutronComponentAutoConfiguration {
NeutronComponent component = new NeutronComponent();
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 NeutronComponentAutoConfiguration {
}
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<NeutronComponent> 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.openstack-neutron.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-neutron.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-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentAutoConfiguration.java
index 75a28bf..df6433f 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/nova/springboot/NovaComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.nova.NovaComponent;
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 NovaComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(NovaComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private NovaComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<NovaComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private NovaComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class NovaComponentAutoConfiguration {
NovaComponent component = new NovaComponent();
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 NovaComponentAutoConfiguration {
}
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<NovaComponent> 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.openstack-nova.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-nova.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-openstack-starter/src/main/java/org/apache/camel/component/openstack/swift/springboot/SwiftComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/swift/springboot/SwiftComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/swift/springboot/SwiftComponentAutoConfiguration.java
index dbb6212..95d1a84 100644
--- a/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/swift/springboot/SwiftComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-openstack-starter/src/main/java/org/apache/camel/component/openstack/swift/springboot/SwiftComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.openstack.swift.SwiftComponent;
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 SwiftComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SwiftComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SwiftComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SwiftComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SwiftComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SwiftComponentAutoConfiguration {
SwiftComponent component = new SwiftComponent();
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 SwiftComponentAutoConfiguration {
}
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<SwiftComponent> 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.openstack-swift.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.openstack-swift.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-optaplanner-starter/src/main/java/org/apache/camel/component/optaplanner/springboot/OptaPlannerComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-optaplanner-starter/src/main/java/org/apache/camel/component/optaplanner/springboot/OptaPlannerComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-optaplanner-starter/src/main/java/org/apache/camel/component/optaplanner/springboot/OptaPlannerComponentAutoConfiguration.java
index aa3cb01..77aa270 100644
--- a/platforms/spring-boot/components-starter/camel-optaplanner-starter/src/main/java/org/apache/camel/component/optaplanner/springboot/OptaPlannerComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-optaplanner-starter/src/main/java/org/apache/camel/component/optaplanner/springboot/OptaPlannerComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.optaplanner.OptaPlannerComponent;
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 OptaPlannerComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(OptaPlannerComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private OptaPlannerComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<OptaPlannerComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private OptaPlannerComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class OptaPlannerComponentAutoConfiguration {
OptaPlannerComponent component = new OptaPlannerComponent();
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 OptaPlannerComponentAutoConfiguration {
}
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<OptaPlannerComponent> 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.optaplanner.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.optaplanner.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-paho-starter/src/main/java/org/apache/camel/component/paho/springboot/PahoComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-paho-starter/src/main/java/org/apache/camel/component/paho/springboot/PahoComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-paho-starter/src/main/java/org/apache/camel/component/paho/springboot/PahoComponentAutoConfiguration.java
index 7c8c9c0..7624280 100644
--- a/platforms/spring-boot/components-starter/camel-paho-starter/src/main/java/org/apache/camel/component/paho/springboot/PahoComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-paho-starter/src/main/java/org/apache/camel/component/paho/springboot/PahoComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.paho.PahoComponent;
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 PahoComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(PahoComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private PahoComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<PahoComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private PahoComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class PahoComponentAutoConfiguration {
PahoComponent component = new PahoComponent();
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 PahoComponentAutoConfiguration {
}
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<PahoComponent> 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.paho.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.paho.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-pdf-starter/src/main/java/org/apache/camel/component/pdf/springboot/PdfComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-pdf-starter/src/main/java/org/apache/camel/component/pdf/springboot/PdfComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-pdf-starter/src/main/java/org/apache/camel/component/pdf/springboot/PdfComponentAutoConfiguration.java
index 5744d96..0e0eda4 100644
--- a/platforms/spring-boot/components-starter/camel-pdf-starter/src/main/java/org/apache/camel/component/pdf/springboot/PdfComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-pdf-starter/src/main/java/org/apache/camel/component/pdf/springboot/PdfComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.pdf.PdfComponent;
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 PdfComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(PdfComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private PdfComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<PdfComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private PdfComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class PdfComponentAutoConfiguration {
PdfComponent component = new PdfComponent();
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 PdfComponentAutoConfiguration {
}
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<PdfComponent> 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.pdf.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.pdf.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-pgevent-starter/src/main/java/org/apache/camel/component/pgevent/springboot/PgEventComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-pgevent-starter/src/main/java/org/apache/camel/component/pgevent/springboot/PgEventComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-pgevent-starter/src/main/java/org/apache/camel/component/pgevent/springboot/PgEventComponentAutoConfiguration.java
index 9f81379..b0dd5c5 100644
--- a/platforms/spring-boot/components-starter/camel-pgevent-starter/src/main/java/org/apache/camel/component/pgevent/springboot/PgEventComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-pgevent-starter/src/main/java/org/apache/camel/component/pgevent/springboot/PgEventComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.pgevent.PgEventComponent;
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 PgEventComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(PgEventComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private PgEventComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<PgEventComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private PgEventComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class PgEventComponentAutoConfiguration {
PgEventComponent component = new PgEventComponent();
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 PgEventComponentAutoConfiguration {
}
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<PgEventComponent> 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.pgevent.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.pgevent.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
[20/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentAutoConfiguration.java
index ea776c9..a24f0af 100644
--- a/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/component/avro/springboot/AvroComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.avro.AvroComponent;
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 AvroComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(AvroComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private AvroComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<AvroComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private AvroComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class AvroComponentAutoConfiguration {
AvroComponent component = new AvroComponent();
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 AvroComponentAutoConfiguration {
}
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<AvroComponent> 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.avro.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.avro.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-avro-starter/src/main/java/org/apache/camel/dataformat/avro/springboot/AvroDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/dataformat/avro/springboot/AvroDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/dataformat/avro/springboot/AvroDataFormatAutoConfiguration.java
index ac045be..2928704 100644
--- a/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/dataformat/avro/springboot/AvroDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-avro-starter/src/main/java/org/apache/camel/dataformat/avro/springboot/AvroDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.avro.AvroDataFormat;
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 AvroDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(AvroDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private AvroDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<AvroDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private AvroDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class AvroDataFormatAutoConfiguration {
}
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 AvroDataFormatAutoConfiguration {
} 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<AvroDataFormat> 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.avro.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.avro.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-aws-starter/src/main/java/org/apache/camel/component/aws/cw/springboot/CwComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/cw/springboot/CwComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/cw/springboot/CwComponentAutoConfiguration.java
index 25c6ee7..49db829 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/cw/springboot/CwComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/cw/springboot/CwComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.aws.cw.CwComponent;
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 CwComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CwComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CwComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<CwComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private CwComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class CwComponentAutoConfiguration {
CwComponent component = new CwComponent();
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 CwComponentAutoConfiguration {
}
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<CwComponent> 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.aws-cw.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.aws-cw.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-aws-starter/src/main/java/org/apache/camel/component/aws/ddb/springboot/DdbComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddb/springboot/DdbComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddb/springboot/DdbComponentAutoConfiguration.java
index 67f3dbf..0549df8 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddb/springboot/DdbComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddb/springboot/DdbComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.aws.ddb.DdbComponent;
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 DdbComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(DdbComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private DdbComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<DdbComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private DdbComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class DdbComponentAutoConfiguration {
DdbComponent component = new DdbComponent();
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 DdbComponentAutoConfiguration {
}
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<DdbComponent> 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.aws-ddb.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.aws-ddb.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-aws-starter/src/main/java/org/apache/camel/component/aws/ddbstream/springboot/DdbStreamComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddbstream/springboot/DdbStreamComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddbstream/springboot/DdbStreamComponentAutoConfiguration.java
index 5dbe1a1..b4af603 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddbstream/springboot/DdbStreamComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ddbstream/springboot/DdbStreamComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.aws.ddbstream.DdbStreamComponent;
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 DdbStreamComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(DdbStreamComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private DdbStreamComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<DdbStreamComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private DdbStreamComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class DdbStreamComponentAutoConfiguration {
DdbStreamComponent component = new DdbStreamComponent();
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 DdbStreamComponentAutoConfiguration {
}
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<DdbStreamComponent> 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.aws-ddbstream.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.aws-ddbstream.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-aws-starter/src/main/java/org/apache/camel/component/aws/ec2/springboot/EC2ComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ec2/springboot/EC2ComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ec2/springboot/EC2ComponentAutoConfiguration.java
index 2a46ea7..4c7a690 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ec2/springboot/EC2ComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ec2/springboot/EC2ComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.aws.ec2.EC2Component;
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 EC2ComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(EC2ComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private EC2ComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<EC2Component>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private EC2ComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class EC2ComponentAutoConfiguration {
EC2Component component = new EC2Component();
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 EC2ComponentAutoConfiguration {
}
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<EC2Component> 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.aws-ec2.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.aws-ec2.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-aws-starter/src/main/java/org/apache/camel/component/aws/firehose/springboot/KinesisFirehoseComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/firehose/springboot/KinesisFirehoseComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/firehose/springboot/KinesisFirehoseComponentAutoConfiguration.java
index b8aca0d..7b51949 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/firehose/springboot/KinesisFirehoseComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/firehose/springboot/KinesisFirehoseComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.aws.firehose.KinesisFirehoseComponent;
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 KinesisFirehoseComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(KinesisFirehoseComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private KinesisFirehoseComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<KinesisFirehoseComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private KinesisFirehoseComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class KinesisFirehoseComponentAutoConfiguration {
KinesisFirehoseComponent component = new KinesisFirehoseComponent();
component.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(componentConfiguration, parameters,
- null, false);
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
Object value = entry.getValue();
Class<?> paramClass = value.getClass();
@@ -102,14 +105,24 @@ public class KinesisFirehoseComponentAutoConfiguration {
}
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<KinesisFirehoseComponent> 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.aws-kinesis-firehose.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.aws-kinesis-firehose.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-aws-starter/src/main/java/org/apache/camel/component/aws/kinesis/springboot/KinesisComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/kinesis/springboot/KinesisComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/kinesis/springboot/KinesisComponentAutoConfiguration.java
index 8932839..49bc7dc 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/kinesis/springboot/KinesisComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/kinesis/springboot/KinesisComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.aws.kinesis.KinesisComponent;
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 KinesisComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(KinesisComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private KinesisComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<KinesisComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private KinesisComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class KinesisComponentAutoConfiguration {
KinesisComponent component = new KinesisComponent();
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 KinesisComponentAutoConfiguration {
}
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<KinesisComponent> 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.aws-kinesis.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.aws-kinesis.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-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentAutoConfiguration.java
index 706af0b..e5fc659 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/s3/springboot/S3ComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.aws.s3.S3Component;
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 S3ComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(S3ComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private S3ComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<S3Component>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private S3ComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class S3ComponentAutoConfiguration {
S3Component component = new S3Component();
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 S3ComponentAutoConfiguration {
}
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<S3Component> 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.aws-s3.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.aws-s3.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-aws-starter/src/main/java/org/apache/camel/component/aws/sdb/springboot/SdbComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sdb/springboot/SdbComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sdb/springboot/SdbComponentAutoConfiguration.java
index 1cacacb..267335a 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sdb/springboot/SdbComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sdb/springboot/SdbComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.aws.sdb.SdbComponent;
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 SdbComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SdbComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SdbComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SdbComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SdbComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SdbComponentAutoConfiguration {
SdbComponent component = new SdbComponent();
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 SdbComponentAutoConfiguration {
}
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<SdbComponent> 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.aws-sdb.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.aws-sdb.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-aws-starter/src/main/java/org/apache/camel/component/aws/ses/springboot/SesComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ses/springboot/SesComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ses/springboot/SesComponentAutoConfiguration.java
index da9954e..3a9beb9 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ses/springboot/SesComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/ses/springboot/SesComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.aws.ses.SesComponent;
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 SesComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SesComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SesComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SesComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SesComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SesComponentAutoConfiguration {
SesComponent component = new SesComponent();
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 SesComponentAutoConfiguration {
}
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<SesComponent> 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.aws-ses.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.aws-ses.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-aws-starter/src/main/java/org/apache/camel/component/aws/sns/springboot/SnsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sns/springboot/SnsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sns/springboot/SnsComponentAutoConfiguration.java
index 27e32a1..f94d644 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sns/springboot/SnsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sns/springboot/SnsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.aws.sns.SnsComponent;
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 SnsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SnsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SnsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SnsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SnsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SnsComponentAutoConfiguration {
SnsComponent component = new SnsComponent();
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 SnsComponentAutoConfiguration {
}
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<SnsComponent> 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.aws-sns.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.aws-sns.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-aws-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentAutoConfiguration.java
index d3e6f61..a7818e9 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/sqs/springboot/SqsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.aws.sqs.SqsComponent;
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 SqsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SqsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SqsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SqsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SqsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SqsComponentAutoConfiguration {
SqsComponent component = new SqsComponent();
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 SqsComponentAutoConfiguration {
}
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<SqsComponent> 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.aws-sqs.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.aws-sqs.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-aws-starter/src/main/java/org/apache/camel/component/aws/swf/springboot/SWFComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/swf/springboot/SWFComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/swf/springboot/SWFComponentAutoConfiguration.java
index d75f839..1d05722 100644
--- a/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/swf/springboot/SWFComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-aws-starter/src/main/java/org/apache/camel/component/aws/swf/springboot/SWFComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.aws.swf.SWFComponent;
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 SWFComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SWFComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SWFComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<SWFComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private SWFComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class SWFComponentAutoConfiguration {
SWFComponent component = new SWFComponent();
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 SWFComponentAutoConfiguration {
}
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<SWFComponent> 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.aws-swf.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.aws-swf.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-azure-starter/src/main/java/org/apache/camel/component/azure/blob/springboot/BlobServiceComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/blob/springboot/BlobServiceComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/blob/springboot/BlobServiceComponentAutoConfiguration.java
index 0e557d8..665951b 100644
--- a/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/blob/springboot/BlobServiceComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/blob/springboot/BlobServiceComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.azure.blob.BlobServiceComponent;
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 BlobServiceComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BlobServiceComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BlobServiceComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<BlobServiceComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private BlobServiceComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class BlobServiceComponentAutoConfiguration {
BlobServiceComponent component = new BlobServiceComponent();
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 BlobServiceComponentAutoConfiguration {
}
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<BlobServiceComponent> 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.azure-blob.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.azure-blob.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-azure-starter/src/main/java/org/apache/camel/component/azure/queue/springboot/QueueServiceComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/queue/springboot/QueueServiceComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/queue/springboot/QueueServiceComponentAutoConfiguration.java
index b2e64b4..c2e885b 100644
--- a/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/queue/springboot/QueueServiceComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-azure-starter/src/main/java/org/apache/camel/component/azure/queue/springboot/QueueServiceComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.azure.queue.QueueServiceComponent;
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 QueueServiceComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(QueueServiceComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private QueueServiceComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<QueueServiceComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private QueueServiceComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class QueueServiceComponentAutoConfiguration {
QueueServiceComponent component = new QueueServiceComponent();
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 QueueServiceComponentAutoConfiguration {
}
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<QueueServiceComponent> 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.azure-queue.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.azure-queue.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
[06/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
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;
[10/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-jcache-starter/src/main/java/org/apache/camel/component/jcache/springboot/JCacheComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jcache-starter/src/main/java/org/apache/camel/component/jcache/springboot/JCacheComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jcache-starter/src/main/java/org/apache/camel/component/jcache/springboot/JCacheComponentAutoConfiguration.java
index 1f3923d..cb5f003 100644
--- a/platforms/spring-boot/components-starter/camel-jcache-starter/src/main/java/org/apache/camel/component/jcache/springboot/JCacheComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jcache-starter/src/main/java/org/apache/camel/component/jcache/springboot/JCacheComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.jcache.JCacheComponent;
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 JCacheComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JCacheComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JCacheComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<JCacheComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private JCacheComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class JCacheComponentAutoConfiguration {
JCacheComponent component = new JCacheComponent();
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 JCacheComponentAutoConfiguration {
}
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<JCacheComponent> 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.jcache.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.jcache.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-jcr-starter/src/main/java/org/apache/camel/component/jcr/springboot/JcrComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jcr-starter/src/main/java/org/apache/camel/component/jcr/springboot/JcrComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jcr-starter/src/main/java/org/apache/camel/component/jcr/springboot/JcrComponentAutoConfiguration.java
index fdbdde9..3d22115 100644
--- a/platforms/spring-boot/components-starter/camel-jcr-starter/src/main/java/org/apache/camel/component/jcr/springboot/JcrComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jcr-starter/src/main/java/org/apache/camel/component/jcr/springboot/JcrComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.jcr.JcrComponent;
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 JcrComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JcrComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JcrComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<JcrComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private JcrComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class JcrComponentAutoConfiguration {
JcrComponent component = new JcrComponent();
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 JcrComponentAutoConfiguration {
}
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<JcrComponent> 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.jcr.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.jcr.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-jdbc-starter/src/main/java/org/apache/camel/component/jdbc/springboot/JdbcComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jdbc-starter/src/main/java/org/apache/camel/component/jdbc/springboot/JdbcComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jdbc-starter/src/main/java/org/apache/camel/component/jdbc/springboot/JdbcComponentAutoConfiguration.java
index 99f4158..ba80a20 100644
--- a/platforms/spring-boot/components-starter/camel-jdbc-starter/src/main/java/org/apache/camel/component/jdbc/springboot/JdbcComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jdbc-starter/src/main/java/org/apache/camel/component/jdbc/springboot/JdbcComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.jdbc.JdbcComponent;
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 JdbcComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JdbcComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JdbcComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<JdbcComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private JdbcComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class JdbcComponentAutoConfiguration {
JdbcComponent component = new JdbcComponent();
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 JdbcComponentAutoConfiguration {
}
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<JdbcComponent> 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.jdbc.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.jdbc.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-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentAutoConfiguration9.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentAutoConfiguration9.java b/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentAutoConfiguration9.java
index e335bd9..daf7cf4 100644
--- a/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentAutoConfiguration9.java
+++ b/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentAutoConfiguration9.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.jetty9.JettyHttpComponent9;
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 JettyHttpComponentAutoConfiguration9 {
private static final Logger LOGGER = LoggerFactory
.getLogger(JettyHttpComponentAutoConfiguration9.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JettyHttpComponentConfiguration9 configuration;
@Autowired(required = false)
private List<ComponentCustomizer<JettyHttpComponent9>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private JettyHttpComponentConfiguration9 componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class JettyHttpComponentAutoConfiguration9 {
JettyHttpComponent9 component = new JettyHttpComponent9();
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 JettyHttpComponentAutoConfiguration9 {
}
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<JettyHttpComponent9> 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.jetty.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.jetty.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-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/JGroupsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/JGroupsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/JGroupsComponentAutoConfiguration.java
index d630246..93556af 100644
--- a/platforms/spring-boot/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/JGroupsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/JGroupsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.jgroups.JGroupsComponent;
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 JGroupsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JGroupsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JGroupsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<JGroupsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private JGroupsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class JGroupsComponentAutoConfiguration {
JGroupsComponent component = new JGroupsComponent();
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 JGroupsComponentAutoConfiguration {
}
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<JGroupsComponent> 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.jgroups.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.jgroups.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-jibx-starter/src/main/java/org/apache/camel/dataformat/jibx/springboot/JibxDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jibx-starter/src/main/java/org/apache/camel/dataformat/jibx/springboot/JibxDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jibx-starter/src/main/java/org/apache/camel/dataformat/jibx/springboot/JibxDataFormatAutoConfiguration.java
index 00a4656..a20cf05 100644
--- a/platforms/spring-boot/components-starter/camel-jibx-starter/src/main/java/org/apache/camel/dataformat/jibx/springboot/JibxDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jibx-starter/src/main/java/org/apache/camel/dataformat/jibx/springboot/JibxDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.jibx.JibxDataFormat;
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 JibxDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JibxDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JibxDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<JibxDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private JibxDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class JibxDataFormatAutoConfiguration {
}
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 JibxDataFormatAutoConfiguration {
} 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<JibxDataFormat> 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.jibx.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.jibx.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-jing-starter/src/main/java/org/apache/camel/component/validator/jing/springboot/JingComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jing-starter/src/main/java/org/apache/camel/component/validator/jing/springboot/JingComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jing-starter/src/main/java/org/apache/camel/component/validator/jing/springboot/JingComponentAutoConfiguration.java
index 91e5ae5..5b2ae92 100644
--- a/platforms/spring-boot/components-starter/camel-jing-starter/src/main/java/org/apache/camel/component/validator/jing/springboot/JingComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jing-starter/src/main/java/org/apache/camel/component/validator/jing/springboot/JingComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.validator.jing.JingComponent;
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 JingComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JingComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JingComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<JingComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private JingComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class JingComponentAutoConfiguration {
JingComponent component = new JingComponent();
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 JingComponentAutoConfiguration {
}
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<JingComponent> 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.jing.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.jing.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-jira-starter/src/main/java/org/apache/camel/component/jira/springboot/JIRAComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jira-starter/src/main/java/org/apache/camel/component/jira/springboot/JIRAComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jira-starter/src/main/java/org/apache/camel/component/jira/springboot/JIRAComponentAutoConfiguration.java
index e9ac93d..2a6b88f 100644
--- a/platforms/spring-boot/components-starter/camel-jira-starter/src/main/java/org/apache/camel/component/jira/springboot/JIRAComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jira-starter/src/main/java/org/apache/camel/component/jira/springboot/JIRAComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.jira.JIRAComponent;
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 JIRAComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JIRAComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JIRAComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<JIRAComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private JIRAComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class JIRAComponentAutoConfiguration {
JIRAComponent component = new JIRAComponent();
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 JIRAComponentAutoConfiguration {
}
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<JIRAComponent> 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.jira.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.jira.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-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentAutoConfiguration.java
index 3552ec0..6b3022b 100644
--- a/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.jms.JmsComponent;
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 JmsComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JmsComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JmsComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<JmsComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private JmsComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class JmsComponentAutoConfiguration {
JmsComponent component = new JmsComponent();
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 JmsComponentAutoConfiguration {
}
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<JmsComponent> 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.jms.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.jms.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-jmx-starter/src/main/java/org/apache/camel/component/jmx/springboot/JMXComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jmx-starter/src/main/java/org/apache/camel/component/jmx/springboot/JMXComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jmx-starter/src/main/java/org/apache/camel/component/jmx/springboot/JMXComponentAutoConfiguration.java
index a33f8ff..e7bebf8 100644
--- a/platforms/spring-boot/components-starter/camel-jmx-starter/src/main/java/org/apache/camel/component/jmx/springboot/JMXComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jmx-starter/src/main/java/org/apache/camel/component/jmx/springboot/JMXComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.jmx.JMXComponent;
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 JMXComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JMXComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JMXComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<JMXComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private JMXComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class JMXComponentAutoConfiguration {
JMXComponent component = new JMXComponent();
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 JMXComponentAutoConfiguration {
}
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<JMXComponent> 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.jmx.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.jmx.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-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatAutoConfiguration.java
index f1586f9..87d2451 100644
--- a/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-johnzon-starter/src/main/java/org/apache/camel/component/johnzon/springboot/JohnzonDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.component.johnzon.JohnzonDataFormat;
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 JohnzonDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JohnzonDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JohnzonDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<JohnzonDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private JohnzonDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class JohnzonDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,27 @@ public class JohnzonDataFormatAutoConfiguration {
} 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<JohnzonDataFormat> 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.json-johnzon.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.json-johnzon.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-jolt-starter/src/main/java/org/apache/camel/component/jolt/springboot/JoltComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jolt-starter/src/main/java/org/apache/camel/component/jolt/springboot/JoltComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jolt-starter/src/main/java/org/apache/camel/component/jolt/springboot/JoltComponentAutoConfiguration.java
index e0d80f6..979e7df 100644
--- a/platforms/spring-boot/components-starter/camel-jolt-starter/src/main/java/org/apache/camel/component/jolt/springboot/JoltComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jolt-starter/src/main/java/org/apache/camel/component/jolt/springboot/JoltComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.jolt.JoltComponent;
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 JoltComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JoltComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JoltComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<JoltComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private JoltComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class JoltComponentAutoConfiguration {
JoltComponent component = new JoltComponent();
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 JoltComponentAutoConfiguration {
}
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<JoltComponent> 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.jolt.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.jolt.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-josql-starter/src/main/java/org/apache/camel/language/sql/springboot/SqlLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-josql-starter/src/main/java/org/apache/camel/language/sql/springboot/SqlLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-josql-starter/src/main/java/org/apache/camel/language/sql/springboot/SqlLanguageAutoConfiguration.java
index be7a2e5..ca108c5 100644
--- a/platforms/spring-boot/components-starter/camel-josql-starter/src/main/java/org/apache/camel/language/sql/springboot/SqlLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-josql-starter/src/main/java/org/apache/camel/language/sql/springboot/SqlLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.language.sql.SqlLanguage;
+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 SqlLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SqlLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SqlLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<SqlLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private SqlLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class SqlLanguageAutoConfiguration {
}
}
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<SqlLanguage> 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.sql.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.sql.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-jpa-starter/src/main/java/org/apache/camel/component/jpa/springboot/JpaComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jpa-starter/src/main/java/org/apache/camel/component/jpa/springboot/JpaComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jpa-starter/src/main/java/org/apache/camel/component/jpa/springboot/JpaComponentAutoConfiguration.java
index 90b90b0..8669349 100644
--- a/platforms/spring-boot/components-starter/camel-jpa-starter/src/main/java/org/apache/camel/component/jpa/springboot/JpaComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jpa-starter/src/main/java/org/apache/camel/component/jpa/springboot/JpaComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.jpa.JpaComponent;
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 JpaComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JpaComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JpaComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<JpaComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private JpaComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class JpaComponentAutoConfiguration {
JpaComponent component = new JpaComponent();
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 JpaComponentAutoConfiguration {
}
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<JpaComponent> 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.jpa.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.jpa.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-jsch-starter/src/main/java/org/apache/camel/component/scp/springboot/ScpComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jsch-starter/src/main/java/org/apache/camel/component/scp/springboot/ScpComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jsch-starter/src/main/java/org/apache/camel/component/scp/springboot/ScpComponentAutoConfiguration.java
index 379ff5f..c410415 100644
--- a/platforms/spring-boot/components-starter/camel-jsch-starter/src/main/java/org/apache/camel/component/scp/springboot/ScpComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jsch-starter/src/main/java/org/apache/camel/component/scp/springboot/ScpComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.scp.ScpComponent;
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 ScpComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ScpComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ScpComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ScpComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ScpComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class ScpComponentAutoConfiguration {
ScpComponent component = new ScpComponent();
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 ScpComponentAutoConfiguration {
}
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<ScpComponent> 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.scp.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.scp.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-jsonpath-starter/src/main/java/org/apache/camel/jsonpath/springboot/JsonPathLanguageAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jsonpath-starter/src/main/java/org/apache/camel/jsonpath/springboot/JsonPathLanguageAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-jsonpath-starter/src/main/java/org/apache/camel/jsonpath/springboot/JsonPathLanguageAutoConfiguration.java
index 267e4ef..4b51f97 100644
--- a/platforms/spring-boot/components-starter/camel-jsonpath-starter/src/main/java/org/apache/camel/jsonpath/springboot/JsonPathLanguageAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jsonpath-starter/src/main/java/org/apache/camel/jsonpath/springboot/JsonPathLanguageAutoConfiguration.java
@@ -23,11 +23,13 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelContextAware;
import org.apache.camel.jsonpath.JsonPathLanguage;
+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 JsonPathLanguageAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JsonPathLanguageAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JsonPathLanguageConfiguration configuration;
@Autowired(required = false)
private List<LanguageCustomizer<JsonPathLanguage>> customizers;
- @Autowired
- private LanguageConfigurationProperties globalConfiguration;
- @Autowired
- private JsonPathLanguageConfiguration languageConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -85,18 +88,27 @@ public class JsonPathLanguageAutoConfiguration {
}
}
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<JsonPathLanguage> 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.jsonpath.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.language.customizer",
+ "camel.language.jsonpath.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure language {}, with customizer {}",
+ language, customizer);
+ customizer.customize(language);
+ }
}
}
return language;
[03/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-stream-starter/src/main/java/org/apache/camel/component/stream/springboot/StreamComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-stream-starter/src/main/java/org/apache/camel/component/stream/springboot/StreamComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-stream-starter/src/main/java/org/apache/camel/component/stream/springboot/StreamComponentAutoConfiguration.java
index d811f3b..51c6b62 100644
--- a/platforms/spring-boot/components-starter/camel-stream-starter/src/main/java/org/apache/camel/component/stream/springboot/StreamComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-stream-starter/src/main/java/org/apache/camel/component/stream/springboot/StreamComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.stream.StreamComponent;
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 StreamComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(StreamComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private StreamComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<StreamComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private StreamComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class StreamComponentAutoConfiguration {
StreamComponent component = new StreamComponent();
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 StreamComponentAutoConfiguration {
}
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<StreamComponent> 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.stream.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.stream.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-stringtemplate-starter/src/main/java/org/apache/camel/component/stringtemplate/springboot/StringTemplateComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-stringtemplate-starter/src/main/java/org/apache/camel/component/stringtemplate/springboot/StringTemplateComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-stringtemplate-starter/src/main/java/org/apache/camel/component/stringtemplate/springboot/StringTemplateComponentAutoConfiguration.java
index 441c9d6..39471ff 100644
--- a/platforms/spring-boot/components-starter/camel-stringtemplate-starter/src/main/java/org/apache/camel/component/stringtemplate/springboot/StringTemplateComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-stringtemplate-starter/src/main/java/org/apache/camel/component/stringtemplate/springboot/StringTemplateComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.stringtemplate.StringTemplateComponent;
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 StringTemplateComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(StringTemplateComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private StringTemplateComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<StringTemplateComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private StringTemplateComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class StringTemplateComponentAutoConfiguration {
StringTemplateComponent component = new StringTemplateComponent();
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 StringTemplateComponentAutoConfiguration {
}
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<StringTemplateComponent> 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.string-template.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.string-template.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-syslog-starter/src/main/java/org/apache/camel/component/syslog/springboot/SyslogDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-syslog-starter/src/main/java/org/apache/camel/component/syslog/springboot/SyslogDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-syslog-starter/src/main/java/org/apache/camel/component/syslog/springboot/SyslogDataFormatAutoConfiguration.java
index 8103228..90d5c8e 100644
--- a/platforms/spring-boot/components-starter/camel-syslog-starter/src/main/java/org/apache/camel/component/syslog/springboot/SyslogDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-syslog-starter/src/main/java/org/apache/camel/component/syslog/springboot/SyslogDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.component.syslog.SyslogDataFormat;
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 SyslogDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(SyslogDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private SyslogDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<SyslogDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private SyslogDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class SyslogDataFormatAutoConfiguration {
}
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 SyslogDataFormatAutoConfiguration {
} 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<SyslogDataFormat> 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.syslog.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.syslog.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-tagsoup-starter/src/main/java/org/apache/camel/dataformat/tagsoup/springboot/TidyMarkupDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-tagsoup-starter/src/main/java/org/apache/camel/dataformat/tagsoup/springboot/TidyMarkupDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-tagsoup-starter/src/main/java/org/apache/camel/dataformat/tagsoup/springboot/TidyMarkupDataFormatAutoConfiguration.java
index 86f4ab3..48074ba 100644
--- a/platforms/spring-boot/components-starter/camel-tagsoup-starter/src/main/java/org/apache/camel/dataformat/tagsoup/springboot/TidyMarkupDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-tagsoup-starter/src/main/java/org/apache/camel/dataformat/tagsoup/springboot/TidyMarkupDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.tagsoup.TidyMarkupDataFormat;
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 TidyMarkupDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(TidyMarkupDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private TidyMarkupDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<TidyMarkupDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private TidyMarkupDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class TidyMarkupDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,27 @@ public class TidyMarkupDataFormatAutoConfiguration {
} 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<TidyMarkupDataFormat> 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.tidymarkup.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.tidymarkup.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-tarfile-starter/src/main/java/org/apache/camel/dataformat/tarfile/springboot/TarFileDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-tarfile-starter/src/main/java/org/apache/camel/dataformat/tarfile/springboot/TarFileDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-tarfile-starter/src/main/java/org/apache/camel/dataformat/tarfile/springboot/TarFileDataFormatAutoConfiguration.java
index 40a82b2..3e8b8a6 100644
--- a/platforms/spring-boot/components-starter/camel-tarfile-starter/src/main/java/org/apache/camel/dataformat/tarfile/springboot/TarFileDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-tarfile-starter/src/main/java/org/apache/camel/dataformat/tarfile/springboot/TarFileDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.tarfile.TarFileDataFormat;
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 TarFileDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(TarFileDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private TarFileDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<TarFileDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private TarFileDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class TarFileDataFormatAutoConfiguration {
}
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 TarFileDataFormatAutoConfiguration {
} 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<TarFileDataFormat> 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.tarfile.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.tarfile.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-telegram-starter/src/main/java/org/apache/camel/component/telegram/springboot/TelegramComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-telegram-starter/src/main/java/org/apache/camel/component/telegram/springboot/TelegramComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-telegram-starter/src/main/java/org/apache/camel/component/telegram/springboot/TelegramComponentAutoConfiguration.java
index 003d6dd..80f6a12 100644
--- a/platforms/spring-boot/components-starter/camel-telegram-starter/src/main/java/org/apache/camel/component/telegram/springboot/TelegramComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-telegram-starter/src/main/java/org/apache/camel/component/telegram/springboot/TelegramComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.telegram.TelegramComponent;
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 TelegramComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(TelegramComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private TelegramComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<TelegramComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private TelegramComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class TelegramComponentAutoConfiguration {
TelegramComponent component = new TelegramComponent();
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 TelegramComponentAutoConfiguration {
}
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<TelegramComponent> 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.telegram.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.telegram.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-tika-starter/src/main/java/org/apache/camel/component/tika/springboot/TikaComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-tika-starter/src/main/java/org/apache/camel/component/tika/springboot/TikaComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-tika-starter/src/main/java/org/apache/camel/component/tika/springboot/TikaComponentAutoConfiguration.java
index 0180ee7..1eef979 100644
--- a/platforms/spring-boot/components-starter/camel-tika-starter/src/main/java/org/apache/camel/component/tika/springboot/TikaComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-tika-starter/src/main/java/org/apache/camel/component/tika/springboot/TikaComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.tika.TikaComponent;
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 TikaComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(TikaComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private TikaComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<TikaComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private TikaComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class TikaComponentAutoConfiguration {
TikaComponent component = new TikaComponent();
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 TikaComponentAutoConfiguration {
}
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<TikaComponent> 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.tika.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.tika.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-twitter-starter/src/main/java/org/apache/camel/component/twitter/springboot/TwitterComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/springboot/TwitterComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/springboot/TwitterComponentAutoConfiguration.java
index a21b66f..b0024eb 100644
--- a/platforms/spring-boot/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/springboot/TwitterComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-twitter-starter/src/main/java/org/apache/camel/component/twitter/springboot/TwitterComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.twitter.TwitterComponent;
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 TwitterComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(TwitterComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private TwitterComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<TwitterComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private TwitterComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class TwitterComponentAutoConfiguration {
TwitterComponent component = new TwitterComponent();
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 TwitterComponentAutoConfiguration {
}
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<TwitterComponent> 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.twitter.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.twitter.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-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentAutoConfiguration.java
index 56fd41f..9941d84 100644
--- a/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/java/org/apache/camel/component/undertow/springboot/UndertowComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.undertow.UndertowComponent;
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 UndertowComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(UndertowComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private UndertowComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<UndertowComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private UndertowComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class UndertowComponentAutoConfiguration {
UndertowComponent component = new UndertowComponent();
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 UndertowComponentAutoConfiguration {
}
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<UndertowComponent> 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.undertow.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.undertow.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-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityCsvDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityCsvDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityCsvDataFormatAutoConfiguration.java
index 3eb0ab9..1ec1a29 100644
--- a/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityCsvDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityCsvDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.univocity.UniVocityCsvDataFormat;
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 UniVocityCsvDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(UniVocityCsvDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private UniVocityCsvDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<UniVocityCsvDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private UniVocityCsvDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class UniVocityCsvDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,27 @@ public class UniVocityCsvDataFormatAutoConfiguration {
} 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<UniVocityCsvDataFormat> 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.univocity-csv.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.univocity-csv.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityFixedWidthDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityFixedWidthDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityFixedWidthDataFormatAutoConfiguration.java
index 95c5064..34b2a6c 100644
--- a/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityFixedWidthDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityFixedWidthDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.univocity.UniVocityFixedWidthDataFormat;
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 UniVocityFixedWidthDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(UniVocityFixedWidthDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private UniVocityFixedWidthDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<UniVocityFixedWidthDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private UniVocityFixedWidthDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class UniVocityFixedWidthDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,27 @@ public class UniVocityFixedWidthDataFormatAutoConfiguration {
} 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<UniVocityFixedWidthDataFormat> 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.univocity-fixed.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.univocity-fixed.customizer");
+ if (useCustomizer) {
+ LOGGER.debug(
+ "Configure dataformat {}, with customizer {}",
+ dataformat, customizer);
+ customizer.customize(dataformat);
+ }
}
}
return dataformat;
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityTsvDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityTsvDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityTsvDataFormatAutoConfiguration.java
index 9f3dc17..4b6106e 100644
--- a/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityTsvDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-univocity-parsers-starter/src/main/java/org/apache/camel/dataformat/univocity/springboot/UniVocityTsvDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.univocity.UniVocityTsvDataFormat;
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 UniVocityTsvDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(UniVocityTsvDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private UniVocityTsvDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<UniVocityTsvDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private UniVocityTsvDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class UniVocityTsvDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,27 @@ public class UniVocityTsvDataFormatAutoConfiguration {
} 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<UniVocityTsvDataFormat> 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.univocity-tsv.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.univocity-tsv.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-velocity-starter/src/main/java/org/apache/camel/component/velocity/springboot/VelocityComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-velocity-starter/src/main/java/org/apache/camel/component/velocity/springboot/VelocityComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-velocity-starter/src/main/java/org/apache/camel/component/velocity/springboot/VelocityComponentAutoConfiguration.java
index 3de8a4f..99903cc 100644
--- a/platforms/spring-boot/components-starter/camel-velocity-starter/src/main/java/org/apache/camel/component/velocity/springboot/VelocityComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-velocity-starter/src/main/java/org/apache/camel/component/velocity/springboot/VelocityComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.velocity.VelocityComponent;
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 VelocityComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(VelocityComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private VelocityComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<VelocityComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private VelocityComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class VelocityComponentAutoConfiguration {
VelocityComponent component = new VelocityComponent();
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 VelocityComponentAutoConfiguration {
}
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<VelocityComponent> 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.velocity.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.velocity.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-vertx-starter/src/main/java/org/apache/camel/component/vertx/springboot/VertxComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-vertx-starter/src/main/java/org/apache/camel/component/vertx/springboot/VertxComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-vertx-starter/src/main/java/org/apache/camel/component/vertx/springboot/VertxComponentAutoConfiguration.java
index 446164e..59c74b6 100644
--- a/platforms/spring-boot/components-starter/camel-vertx-starter/src/main/java/org/apache/camel/component/vertx/springboot/VertxComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-vertx-starter/src/main/java/org/apache/camel/component/vertx/springboot/VertxComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.vertx.VertxComponent;
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 VertxComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(VertxComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private VertxComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<VertxComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private VertxComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class VertxComponentAutoConfiguration {
VertxComponent component = new VertxComponent();
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 VertxComponentAutoConfiguration {
}
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<VertxComponent> 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.vertx.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.vertx.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-weather-starter/src/main/java/org/apache/camel/component/weather/springboot/WeatherComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-weather-starter/src/main/java/org/apache/camel/component/weather/springboot/WeatherComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-weather-starter/src/main/java/org/apache/camel/component/weather/springboot/WeatherComponentAutoConfiguration.java
index 2254cd5..bb16775 100644
--- a/platforms/spring-boot/components-starter/camel-weather-starter/src/main/java/org/apache/camel/component/weather/springboot/WeatherComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-weather-starter/src/main/java/org/apache/camel/component/weather/springboot/WeatherComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.weather.WeatherComponent;
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 WeatherComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(WeatherComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private WeatherComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<WeatherComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private WeatherComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class WeatherComponentAutoConfiguration {
WeatherComponent component = new WeatherComponent();
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 WeatherComponentAutoConfiguration {
}
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<WeatherComponent> 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.weather.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.weather.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-websocket-starter/src/main/java/org/apache/camel/component/websocket/springboot/WebsocketComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-websocket-starter/src/main/java/org/apache/camel/component/websocket/springboot/WebsocketComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-websocket-starter/src/main/java/org/apache/camel/component/websocket/springboot/WebsocketComponentAutoConfiguration.java
index ec62cf3..1446eb7 100644
--- a/platforms/spring-boot/components-starter/camel-websocket-starter/src/main/java/org/apache/camel/component/websocket/springboot/WebsocketComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-websocket-starter/src/main/java/org/apache/camel/component/websocket/springboot/WebsocketComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.websocket.WebsocketComponent;
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 WebsocketComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(WebsocketComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private WebsocketComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<WebsocketComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private WebsocketComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class WebsocketComponentAutoConfiguration {
WebsocketComponent component = new WebsocketComponent();
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 WebsocketComponentAutoConfiguration {
}
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<WebsocketComponent> 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.websocket.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.websocket.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
[02/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-xmlbeans-starter/src/main/java/org/apache/camel/converter/xmlbeans/springboot/XmlBeansDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-xmlbeans-starter/src/main/java/org/apache/camel/converter/xmlbeans/springboot/XmlBeansDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xmlbeans-starter/src/main/java/org/apache/camel/converter/xmlbeans/springboot/XmlBeansDataFormatAutoConfiguration.java
index 17e6b89..b7c67d5 100644
--- a/platforms/spring-boot/components-starter/camel-xmlbeans-starter/src/main/java/org/apache/camel/converter/xmlbeans/springboot/XmlBeansDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xmlbeans-starter/src/main/java/org/apache/camel/converter/xmlbeans/springboot/XmlBeansDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.converter.xmlbeans.XmlBeansDataFormat;
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 XmlBeansDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(XmlBeansDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private XmlBeansDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<XmlBeansDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private XmlBeansDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class XmlBeansDataFormatAutoConfiguration {
}
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 XmlBeansDataFormatAutoConfiguration {
} 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<XmlBeansDataFormat> 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.xmlbeans.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.xmlbeans.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-xmljson-starter/src/main/java/org/apache/camel/dataformat/xmljson/springboot/XmlJsonDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-xmljson-starter/src/main/java/org/apache/camel/dataformat/xmljson/springboot/XmlJsonDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xmljson-starter/src/main/java/org/apache/camel/dataformat/xmljson/springboot/XmlJsonDataFormatAutoConfiguration.java
index 553eb55..ed6e3ce 100644
--- a/platforms/spring-boot/components-starter/camel-xmljson-starter/src/main/java/org/apache/camel/dataformat/xmljson/springboot/XmlJsonDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xmljson-starter/src/main/java/org/apache/camel/dataformat/xmljson/springboot/XmlJsonDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.xmljson.XmlJsonDataFormat;
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 XmlJsonDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(XmlJsonDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private XmlJsonDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<XmlJsonDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private XmlJsonDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class XmlJsonDataFormatAutoConfiguration {
}
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 XmlJsonDataFormatAutoConfiguration {
} 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<XmlJsonDataFormat> 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.xmljson.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.xmljson.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-xmlrpc-starter/src/main/java/org/apache/camel/component/xmlrpc/springboot/XmlRpcComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/component/xmlrpc/springboot/XmlRpcComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/component/xmlrpc/springboot/XmlRpcComponentAutoConfiguration.java
index 267dee8..b53e5a1 100644
--- a/platforms/spring-boot/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/component/xmlrpc/springboot/XmlRpcComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/component/xmlrpc/springboot/XmlRpcComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.xmlrpc.XmlRpcComponent;
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 XmlRpcComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(XmlRpcComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private XmlRpcComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<XmlRpcComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private XmlRpcComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class XmlRpcComponentAutoConfiguration {
XmlRpcComponent component = new XmlRpcComponent();
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 XmlRpcComponentAutoConfiguration {
}
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<XmlRpcComponent> 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.xmlrpc.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.xmlrpc.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-xmlrpc-starter/src/main/java/org/apache/camel/dataformat/xmlrpc/springboot/XmlRpcDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/dataformat/xmlrpc/springboot/XmlRpcDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/dataformat/xmlrpc/springboot/XmlRpcDataFormatAutoConfiguration.java
index 601cacd..63fb41f 100644
--- a/platforms/spring-boot/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/dataformat/xmlrpc/springboot/XmlRpcDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xmlrpc-starter/src/main/java/org/apache/camel/dataformat/xmlrpc/springboot/XmlRpcDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.xmlrpc.XmlRpcDataFormat;
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 XmlRpcDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(XmlRpcDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private XmlRpcDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<XmlRpcDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private XmlRpcDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class XmlRpcDataFormatAutoConfiguration {
}
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 XmlRpcDataFormatAutoConfiguration {
} 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<XmlRpcDataFormat> 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.xmlrpc.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.xmlrpc.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-xmlsecurity-starter/src/main/java/org/apache/camel/component/xmlsecurity/springboot/XmlSignatureComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/component/xmlsecurity/springboot/XmlSignatureComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/component/xmlsecurity/springboot/XmlSignatureComponentAutoConfiguration.java
index 2f0d150..b3f9407 100644
--- a/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/component/xmlsecurity/springboot/XmlSignatureComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/component/xmlsecurity/springboot/XmlSignatureComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.xmlsecurity.XmlSignatureComponent;
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 XmlSignatureComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(XmlSignatureComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private XmlSignatureComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<XmlSignatureComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private XmlSignatureComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class XmlSignatureComponentAutoConfiguration {
XmlSignatureComponent component = new XmlSignatureComponent();
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 XmlSignatureComponentAutoConfiguration {
}
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<XmlSignatureComponent> 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.xmlsecurity.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.xmlsecurity.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-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatAutoConfiguration.java
index ba80612..46a1011 100644
--- a/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xmlsecurity-starter/src/main/java/org/apache/camel/dataformat/xmlsecurity/springboot/XMLSecurityDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.xmlsecurity.XMLSecurityDataFormat;
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 XMLSecurityDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(XMLSecurityDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private XMLSecurityDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<XMLSecurityDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private XMLSecurityDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class XMLSecurityDataFormatAutoConfiguration {
}
try {
Map<String, Object> parameters = new HashMap<>();
- IntrospectionSupport.getProperties(dataformatConfiguration,
+ IntrospectionSupport.getProperties(configuration,
parameters, null, false);
IntrospectionSupport.setProperties(camelContext,
camelContext.getTypeConverter(), dataformat,
@@ -99,15 +102,27 @@ public class XMLSecurityDataFormatAutoConfiguration {
} 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<XMLSecurityDataFormat> 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.securexml.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.securexml.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-xmpp-starter/src/main/java/org/apache/camel/component/xmpp/springboot/XmppComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-xmpp-starter/src/main/java/org/apache/camel/component/xmpp/springboot/XmppComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xmpp-starter/src/main/java/org/apache/camel/component/xmpp/springboot/XmppComponentAutoConfiguration.java
index 50bf6e5..8fdfe96 100644
--- a/platforms/spring-boot/components-starter/camel-xmpp-starter/src/main/java/org/apache/camel/component/xmpp/springboot/XmppComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xmpp-starter/src/main/java/org/apache/camel/component/xmpp/springboot/XmppComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.xmpp.XmppComponent;
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 XmppComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(XmppComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private XmppComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<XmppComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private XmppComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class XmppComponentAutoConfiguration {
XmppComponent component = new XmppComponent();
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 XmppComponentAutoConfiguration {
}
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<XmppComponent> 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.xmpp.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.xmpp.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-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatAutoConfiguration.java
index cc88870..ddae965 100644
--- a/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/JsonDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.xstream.JsonDataFormat;
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 JsonDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(JsonDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private JsonDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<JsonDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private JsonDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -90,7 +93,7 @@ public class JsonDataFormatAutoConfiguration {
}
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,27 @@ public class JsonDataFormatAutoConfiguration {
} 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<JsonDataFormat> 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.json-xstream.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator
+ .evaluate(applicationContext
+ .getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.json-xstream.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-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/XStreamDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/XStreamDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/XStreamDataFormatAutoConfiguration.java
index 5b2e65c..da4e6f7 100644
--- a/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/XStreamDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-xstream-starter/src/main/java/org/apache/camel/dataformat/xstream/springboot/XStreamDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.xstream.XStreamDataFormat;
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 XStreamDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(XStreamDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private XStreamDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<XStreamDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private XStreamDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class XStreamDataFormatAutoConfiguration {
}
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 XStreamDataFormatAutoConfiguration {
} 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<XStreamDataFormat> 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.xstream.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.xstream.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-yammer-starter/src/main/java/org/apache/camel/component/yammer/springboot/YammerComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-yammer-starter/src/main/java/org/apache/camel/component/yammer/springboot/YammerComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-yammer-starter/src/main/java/org/apache/camel/component/yammer/springboot/YammerComponentAutoConfiguration.java
index 8acf7a0..92a27e9 100644
--- a/platforms/spring-boot/components-starter/camel-yammer-starter/src/main/java/org/apache/camel/component/yammer/springboot/YammerComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-yammer-starter/src/main/java/org/apache/camel/component/yammer/springboot/YammerComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.yammer.YammerComponent;
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 YammerComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(YammerComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private YammerComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<YammerComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private YammerComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class YammerComponentAutoConfiguration {
YammerComponent component = new YammerComponent();
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 YammerComponentAutoConfiguration {
}
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<YammerComponent> 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.yammer.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.yammer.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-zendesk-starter/src/main/java/org/apache/camel/component/zendesk/springboot/ZendeskComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-zendesk-starter/src/main/java/org/apache/camel/component/zendesk/springboot/ZendeskComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-zendesk-starter/src/main/java/org/apache/camel/component/zendesk/springboot/ZendeskComponentAutoConfiguration.java
index ffbcb5e..2b41ab3 100644
--- a/platforms/spring-boot/components-starter/camel-zendesk-starter/src/main/java/org/apache/camel/component/zendesk/springboot/ZendeskComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-zendesk-starter/src/main/java/org/apache/camel/component/zendesk/springboot/ZendeskComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.zendesk.ZendeskComponent;
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 ZendeskComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ZendeskComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ZendeskComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ZendeskComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ZendeskComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class ZendeskComponentAutoConfiguration {
ZendeskComponent component = new ZendeskComponent();
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 ZendeskComponentAutoConfiguration {
}
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<ZendeskComponent> 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.zendesk.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.zendesk.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-zipfile-starter/src/main/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-zipfile-starter/src/main/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-zipfile-starter/src/main/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatAutoConfiguration.java
index 781f8ff..b66a0e8 100644
--- a/platforms/spring-boot/components-starter/camel-zipfile-starter/src/main/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-zipfile-starter/src/main/java/org/apache/camel/dataformat/zipfile/springboot/ZipFileDataFormatAutoConfiguration.java
@@ -27,10 +27,12 @@ import org.apache.camel.dataformat.zipfile.ZipFileDataFormat;
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 ZipFileDataFormatAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ZipFileDataFormatAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ZipFileDataFormatConfiguration configuration;
@Autowired(required = false)
private List<DataFormatCustomizer<ZipFileDataFormat>> customizers;
- @Autowired
- private DataFormatConfigurationProperties globalConfiguration;
- @Autowired
- private ZipFileDataFormatConfiguration dataformatConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -91,7 +94,7 @@ public class ZipFileDataFormatAutoConfiguration {
}
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 ZipFileDataFormatAutoConfiguration {
} 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<ZipFileDataFormat> 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.zipfile.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.dataformat.customizer",
+ "camel.dataformat.zipfile.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-zookeeper-master-starter/src/main/java/org/apache/camel/component/zookeepermaster/springboot/MasterComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-zookeeper-master-starter/src/main/java/org/apache/camel/component/zookeepermaster/springboot/MasterComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-zookeeper-master-starter/src/main/java/org/apache/camel/component/zookeepermaster/springboot/MasterComponentAutoConfiguration.java
index 420901c..86b1b79 100644
--- a/platforms/spring-boot/components-starter/camel-zookeeper-master-starter/src/main/java/org/apache/camel/component/zookeepermaster/springboot/MasterComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-zookeeper-master-starter/src/main/java/org/apache/camel/component/zookeepermaster/springboot/MasterComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.zookeepermaster.MasterComponent;
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 MasterComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(MasterComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private MasterComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<MasterComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private MasterComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class MasterComponentAutoConfiguration {
MasterComponent component = new MasterComponent();
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 MasterComponentAutoConfiguration {
}
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<MasterComponent> 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.zookeeper-master.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.zookeeper-master.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-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/ZooKeeperComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/ZooKeeperComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/ZooKeeperComponentAutoConfiguration.java
index adeb30c..09748b3 100644
--- a/platforms/spring-boot/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/ZooKeeperComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/ZooKeeperComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.zookeeper.ZooKeeperComponent;
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 ZooKeeperComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ZooKeeperComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ZooKeeperComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ZooKeeperComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ZooKeeperComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class ZooKeeperComponentAutoConfiguration {
ZooKeeperComponent component = new ZooKeeperComponent();
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 ZooKeeperComponentAutoConfiguration {
}
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<ZooKeeperComponent> 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.zookeeper.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.zookeeper.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;
[18/21] camel git commit: camel-spring-boot: improve customizer
configuration
Posted by lb...@apache.org.
http://git-wip-us.apache.org/repos/asf/camel/blob/1ca7a426/platforms/spring-boot/components-starter/camel-chunk-starter/src/main/java/org/apache/camel/component/chunk/springboot/ChunkComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-chunk-starter/src/main/java/org/apache/camel/component/chunk/springboot/ChunkComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-chunk-starter/src/main/java/org/apache/camel/component/chunk/springboot/ChunkComponentAutoConfiguration.java
index 2590ac0..95e7bc5 100644
--- a/platforms/spring-boot/components-starter/camel-chunk-starter/src/main/java/org/apache/camel/component/chunk/springboot/ChunkComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-chunk-starter/src/main/java/org/apache/camel/component/chunk/springboot/ChunkComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.chunk.ChunkComponent;
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 ChunkComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ChunkComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ChunkComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ChunkComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ChunkComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class ChunkComponentAutoConfiguration {
ChunkComponent component = new ChunkComponent();
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 ChunkComponentAutoConfiguration {
}
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<ChunkComponent> 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.chunk.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.chunk.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-cm-sms-starter/src/main/java/org/apache/camel/component/cm/springboot/CMComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-cm-sms-starter/src/main/java/org/apache/camel/component/cm/springboot/CMComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-cm-sms-starter/src/main/java/org/apache/camel/component/cm/springboot/CMComponentAutoConfiguration.java
index 4fdf432..0513a9d 100644
--- a/platforms/spring-boot/components-starter/camel-cm-sms-starter/src/main/java/org/apache/camel/component/cm/springboot/CMComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-cm-sms-starter/src/main/java/org/apache/camel/component/cm/springboot/CMComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.cm.CMComponent;
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 CMComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CMComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CMComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<CMComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private CMComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class CMComponentAutoConfiguration {
CMComponent component = new CMComponent();
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 CMComponentAutoConfiguration {
}
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<CMComponent> 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.cm-sms.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.cm-sms.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-cmis-starter/src/main/java/org/apache/camel/component/cmis/springboot/CMISComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-cmis-starter/src/main/java/org/apache/camel/component/cmis/springboot/CMISComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-cmis-starter/src/main/java/org/apache/camel/component/cmis/springboot/CMISComponentAutoConfiguration.java
index e40d1d9..a3e3919 100644
--- a/platforms/spring-boot/components-starter/camel-cmis-starter/src/main/java/org/apache/camel/component/cmis/springboot/CMISComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-cmis-starter/src/main/java/org/apache/camel/component/cmis/springboot/CMISComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.cmis.CMISComponent;
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 CMISComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CMISComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CMISComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<CMISComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private CMISComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class CMISComponentAutoConfiguration {
CMISComponent component = new CMISComponent();
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 CMISComponentAutoConfiguration {
}
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<CMISComponent> 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.cmis.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.cmis.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-coap-starter/src/main/java/org/apache/camel/coap/springboot/CoAPComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-coap-starter/src/main/java/org/apache/camel/coap/springboot/CoAPComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-coap-starter/src/main/java/org/apache/camel/coap/springboot/CoAPComponentAutoConfiguration.java
index 8ef4049..924acda 100644
--- a/platforms/spring-boot/components-starter/camel-coap-starter/src/main/java/org/apache/camel/coap/springboot/CoAPComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-coap-starter/src/main/java/org/apache/camel/coap/springboot/CoAPComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.coap.CoAPComponent;
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 CoAPComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CoAPComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CoAPComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<CoAPComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private CoAPComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class CoAPComponentAutoConfiguration {
CoAPComponent component = new CoAPComponent();
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 CoAPComponentAutoConfiguration {
}
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<CoAPComponent> 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.coap.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.coap.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-cometd-starter/src/main/java/org/apache/camel/component/cometd/springboot/CometdComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-cometd-starter/src/main/java/org/apache/camel/component/cometd/springboot/CometdComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-cometd-starter/src/main/java/org/apache/camel/component/cometd/springboot/CometdComponentAutoConfiguration.java
index 160ba57..960b9dd 100644
--- a/platforms/spring-boot/components-starter/camel-cometd-starter/src/main/java/org/apache/camel/component/cometd/springboot/CometdComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-cometd-starter/src/main/java/org/apache/camel/component/cometd/springboot/CometdComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.cometd.CometdComponent;
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 CometdComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(CometdComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private CometdComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<CometdComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private CometdComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class CometdComponentAutoConfiguration {
CometdComponent component = new CometdComponent();
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 CometdComponentAutoConfiguration {
}
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<CometdComponent> 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.cometd.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.cometd.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-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentAutoConfiguration.java
index c80838a..0d586ef 100644
--- a/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.consul.ConsulComponent;
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 ConsulComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ConsulComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ConsulComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ConsulComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ConsulComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class ConsulComponentAutoConfiguration {
ConsulComponent component = new ConsulComponent();
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 ConsulComponentAutoConfiguration {
}
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<ConsulComponent> 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.consul.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.consul.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-context-starter/src/main/java/org/apache/camel/component/context/springboot/QualifiedContextComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-context-starter/src/main/java/org/apache/camel/component/context/springboot/QualifiedContextComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-context-starter/src/main/java/org/apache/camel/component/context/springboot/QualifiedContextComponentAutoConfiguration.java
index 5b1142e..d622147 100644
--- a/platforms/spring-boot/components-starter/camel-context-starter/src/main/java/org/apache/camel/component/context/springboot/QualifiedContextComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-context-starter/src/main/java/org/apache/camel/component/context/springboot/QualifiedContextComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.context.QualifiedContextComponent;
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 QualifiedContextComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(QualifiedContextComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private QualifiedContextComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<QualifiedContextComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private QualifiedContextComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class QualifiedContextComponentAutoConfiguration {
QualifiedContextComponent component = new QualifiedContextComponent();
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 QualifiedContextComponentAutoConfiguration {
}
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<QualifiedContextComponent> 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.context.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.context.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-core-starter/src/main/java/org/apache/camel/component/bean/springboot/BeanComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/bean/springboot/BeanComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/bean/springboot/BeanComponentAutoConfiguration.java
index e88d559..c105de7 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/bean/springboot/BeanComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/bean/springboot/BeanComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.bean.BeanComponent;
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 BeanComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BeanComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BeanComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<BeanComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private BeanComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class BeanComponentAutoConfiguration {
BeanComponent component = new BeanComponent();
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 BeanComponentAutoConfiguration {
}
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<BeanComponent> customizer : customizers) {
- LOGGER.debug("Configure component {}, with customizer {}",
- component, customizer);
- customizer.customize(component);
+ boolean useCustomizer = (customizer instanceof HasId)
+ ? HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.bean.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.bean.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-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentAutoConfiguration.java
index 6f2346e..fbc8382 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.beanclass.ClassComponent;
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 ClassComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ClassComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ClassComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ClassComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ClassComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class ClassComponentAutoConfiguration {
ClassComponent component = new ClassComponent();
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 ClassComponentAutoConfiguration {
}
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<ClassComponent> 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.class.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.class.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-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentAutoConfiguration.java
index b75d31d..e24b90b 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.binding.BindingNameComponent;
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 BindingNameComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BindingNameComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BindingNameComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<BindingNameComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private BindingNameComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -78,8 +81,8 @@ public class BindingNameComponentAutoConfiguration {
BindingNameComponent component = new BindingNameComponent();
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 BindingNameComponentAutoConfiguration {
}
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<BindingNameComponent> 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.binding.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.binding.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-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentAutoConfiguration.java
index 51a5a48..1ea0571 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.browse.BrowseComponent;
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 BrowseComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(BrowseComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private BrowseComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<BrowseComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private BrowseComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class BrowseComponentAutoConfiguration {
BrowseComponent component = new BrowseComponent();
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 BrowseComponentAutoConfiguration {
}
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<BrowseComponent> 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.browse.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.browse.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-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java
index e058778..75f7818 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.controlbus.ControlBusComponent;
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 ControlBusComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(ControlBusComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private ControlBusComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<ControlBusComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private ControlBusComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class ControlBusComponentAutoConfiguration {
ControlBusComponent component = new ControlBusComponent();
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 ControlBusComponentAutoConfiguration {
}
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<ControlBusComponent> 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.controlbus.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.controlbus.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-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java
index e4e52df..5693f66 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.dataformat.DataFormatComponent;
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 DataFormatComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(DataFormatComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private DataFormatComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<DataFormatComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private DataFormatComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class DataFormatComponentAutoConfiguration {
DataFormatComponent component = new DataFormatComponent();
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 DataFormatComponentAutoConfiguration {
}
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<DataFormatComponent> 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.dataformat.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.dataformat.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-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java
index f980917..93f5f90 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.dataset.DataSetComponent;
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 DataSetComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(DataSetComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private DataSetComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<DataSetComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private DataSetComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class DataSetComponentAutoConfiguration {
DataSetComponent component = new DataSetComponent();
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 DataSetComponentAutoConfiguration {
}
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<DataSetComponent> 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.dataset.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.dataset.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-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentAutoConfiguration.java
index 8af5edd..05bd34b 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.direct.DirectComponent;
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 DirectComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(DirectComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private DirectComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<DirectComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private DirectComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class DirectComponentAutoConfiguration {
DirectComponent component = new DirectComponent();
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 DirectComponentAutoConfiguration {
}
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<DirectComponent> 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.direct.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.direct.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-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentAutoConfiguration.java
index 36e0f82..bfd4a08 100644
--- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentAutoConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentAutoConfiguration.java
@@ -23,10 +23,12 @@ import javax.annotation.Generated;
import org.apache.camel.CamelContext;
import org.apache.camel.component.directvm.DirectVmComponent;
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 DirectVmComponentAutoConfiguration {
private static final Logger LOGGER = LoggerFactory
.getLogger(DirectVmComponentAutoConfiguration.class);
@Autowired
+ private ApplicationContext applicationContext;
+ @Autowired
private CamelContext camelContext;
+ @Autowired
+ private DirectVmComponentConfiguration configuration;
@Autowired(required = false)
private List<ComponentCustomizer<DirectVmComponent>> customizers;
- @Autowired
- private ComponentConfigurationProperties globalConfiguration;
- @Autowired
- private DirectVmComponentConfiguration componentConfiguration;
static class GroupConditions extends GroupCondition {
public GroupConditions() {
@@ -77,8 +80,8 @@ public class DirectVmComponentAutoConfiguration {
DirectVmComponent component = new DirectVmComponent();
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 DirectVmComponentAutoConfiguration {
}
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<DirectVmComponent> 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.direct-vm.customizer",
+ ((HasId) customizer).getId())
+ : HierarchicalPropertiesEvaluator.evaluate(
+ applicationContext.getEnvironment(),
+ "camel.component.customizer",
+ "camel.component.direct-vm.customizer");
+ if (useCustomizer) {
+ LOGGER.debug("Configure component {}, with customizer {}",
+ component, customizer);
+ customizer.customize(component);
+ }
}
}
return component;