You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/03/04 12:21:03 UTC
[02/17] camel git commit: CAMEL-10937: Camel components - Configured
using setters should support property placeholders
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-schematron-starter/src/main/java/org/apache/camel/component/schematron/springboot/SchematronComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-schematron-starter/src/main/java/org/apache/camel/component/schematron/springboot/SchematronComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-schematron-starter/src/main/java/org/apache/camel/component/schematron/springboot/SchematronComponentConfiguration.java
new file mode 100644
index 0000000..5dfa627
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-schematron-starter/src/main/java/org/apache/camel/component/schematron/springboot/SchematronComponentConfiguration.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.component.schematron.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * Validates the payload of a message using the Schematron Library.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.schematron")
+public class SchematronComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentConfiguration.java
index 83809362..f451cb0 100644
--- a/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentConfiguration.java
@@ -63,6 +63,12 @@ public class ServiceNowComponentConfiguration {
* OAuth token Url
*/
private String oauthTokenUrl;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public ServiceNowConfigurationNestedConfiguration getConfiguration() {
return configuration;
@@ -121,6 +127,15 @@ public class ServiceNowComponentConfiguration {
this.oauthTokenUrl = oauthTokenUrl;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class ServiceNowConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.servicenow.ServiceNowConfiguration.class;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletComponentConfiguration.java
index 9c140de..7aee22d 100644
--- a/platforms/spring-boot/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-servlet-starter/src/main/java/org/apache/camel/component/servlet/springboot/ServletComponentConfiguration.java
@@ -75,6 +75,12 @@ public class ServletComponentConfiguration {
*/
@NestedConfigurationProperty
private HeaderFilterStrategy headerFilterStrategy;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public String getServletName() {
return servletName;
@@ -132,4 +138,13 @@ public class ServletComponentConfiguration {
HeaderFilterStrategy headerFilterStrategy) {
this.headerFilterStrategy = headerFilterStrategy;
}
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/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 48122e0..06e6a0e 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.sip.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.sip.SipComponent;
+import org.apache.camel.util.IntrospectionSupport;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
@@ -26,6 +29,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.boot.bind.RelaxedPropertyResolver;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
@@ -40,16 +44,42 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(SipComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(SipComponentConfiguration.class)
public class SipComponentAutoConfiguration {
@Lazy
@Bean(name = {"sip-component", "sips-component"})
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(SipComponent.class)
- public SipComponent configureSipComponent(CamelContext camelContext)
- throws Exception {
+ public SipComponent configureSipComponent(CamelContext camelContext,
+ SipComponentConfiguration configuration) throws Exception {
SipComponent component = new SipComponent();
component.setCamelContext(camelContext);
+ Map<String, Object> parameters = new HashMap<>();
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
+ for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+ Object value = entry.getValue();
+ Class<?> paramClass = value.getClass();
+ if (paramClass.getName().endsWith("NestedConfiguration")) {
+ Class nestedClass = null;
+ try {
+ nestedClass = (Class) paramClass.getDeclaredField(
+ "CAMEL_NESTED_CLASS").get(null);
+ HashMap<String, Object> nestedParameters = new HashMap<>();
+ IntrospectionSupport.getProperties(value, nestedParameters,
+ null, false);
+ Object nestedProperty = nestedClass.newInstance();
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), nestedProperty,
+ nestedParameters);
+ entry.setValue(nestedProperty);
+ } catch (NoSuchFieldException e) {
+ }
+ }
+ }
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), component, parameters);
return component;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-sip-starter/src/main/java/org/apache/camel/component/sip/springboot/SipComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-sip-starter/src/main/java/org/apache/camel/component/sip/springboot/SipComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-sip-starter/src/main/java/org/apache/camel/component/sip/springboot/SipComponentConfiguration.java
new file mode 100644
index 0000000..2b8c16a
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-sip-starter/src/main/java/org/apache/camel/component/sip/springboot/SipComponentConfiguration.java
@@ -0,0 +1,45 @@
+/**
+ * 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.sip.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * To send and receive messages using the SIP protocol (used in telco and
+ * mobile).
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.sip")
+public class SipComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/batch/springboot/SjmsBatchComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/batch/springboot/SjmsBatchComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/batch/springboot/SjmsBatchComponentConfiguration.java
index fde3431..5b9ac23 100644
--- a/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/batch/springboot/SjmsBatchComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/batch/springboot/SjmsBatchComponentConfiguration.java
@@ -59,6 +59,12 @@ public class SjmsBatchComponentConfiguration {
*/
@NestedConfigurationProperty
private HeaderFilterStrategy headerFilterStrategy;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public ConnectionFactory getConnectionFactory() {
return connectionFactory;
@@ -92,4 +98,13 @@ public class SjmsBatchComponentConfiguration {
HeaderFilterStrategy headerFilterStrategy) {
this.headerFilterStrategy = headerFilterStrategy;
}
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/springboot/SjmsComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/springboot/SjmsComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/springboot/SjmsComponentConfiguration.java
index daba7f4..5885f67 100644
--- a/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/springboot/SjmsComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-sjms-starter/src/main/java/org/apache/camel/component/sjms/springboot/SjmsComponentConfiguration.java
@@ -92,6 +92,12 @@ public class SjmsComponentConfiguration {
*/
@NestedConfigurationProperty
private HeaderFilterStrategy headerFilterStrategy;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public ConnectionFactory getConnectionFactory() {
return connectionFactory;
@@ -171,6 +177,15 @@ public class SjmsComponentConfiguration {
this.headerFilterStrategy = headerFilterStrategy;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class TimedTaskManagerNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.sjms.taskmanager.TimedTaskManager.class;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-slack-starter/src/main/java/org/apache/camel/component/slack/springboot/SlackComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-slack-starter/src/main/java/org/apache/camel/component/slack/springboot/SlackComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-slack-starter/src/main/java/org/apache/camel/component/slack/springboot/SlackComponentConfiguration.java
index 59ceb03..aa92aa0 100644
--- a/platforms/spring-boot/components-starter/camel-slack-starter/src/main/java/org/apache/camel/component/slack/springboot/SlackComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-slack-starter/src/main/java/org/apache/camel/component/slack/springboot/SlackComponentConfiguration.java
@@ -30,6 +30,12 @@ public class SlackComponentConfiguration {
* The incoming webhook URL
*/
private String webhookUrl;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public String getWebhookUrl() {
return webhookUrl;
@@ -38,4 +44,13 @@ public class SlackComponentConfiguration {
public void setWebhookUrl(String webhookUrl) {
this.webhookUrl = webhookUrl;
}
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-smpp-starter/src/main/java/org/apache/camel/component/smpp/springboot/SmppComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-smpp-starter/src/main/java/org/apache/camel/component/smpp/springboot/SmppComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-smpp-starter/src/main/java/org/apache/camel/component/smpp/springboot/SmppComponentConfiguration.java
index 6768a31..9ec56cb 100644
--- a/platforms/spring-boot/components-starter/camel-smpp-starter/src/main/java/org/apache/camel/component/smpp/springboot/SmppComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-smpp-starter/src/main/java/org/apache/camel/component/smpp/springboot/SmppComponentConfiguration.java
@@ -34,6 +34,12 @@ public class SmppComponentConfiguration {
* To use the shared SmppConfiguration as configuration.
*/
private SmppConfigurationNestedConfiguration configuration;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public SmppConfigurationNestedConfiguration getConfiguration() {
return configuration;
@@ -44,6 +50,15 @@ public class SmppComponentConfiguration {
this.configuration = configuration;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class SmppConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.smpp.SmppConfiguration.class;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/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 14839fa..448be4e 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.snmp.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.snmp.SnmpComponent;
+import org.apache.camel.util.IntrospectionSupport;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
@@ -26,6 +29,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.boot.bind.RelaxedPropertyResolver;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
@@ -40,16 +44,42 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(SnmpComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(SnmpComponentConfiguration.class)
public class SnmpComponentAutoConfiguration {
@Lazy
@Bean(name = "snmp-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(SnmpComponent.class)
- public SnmpComponent configureSnmpComponent(CamelContext camelContext)
- throws Exception {
+ public SnmpComponent configureSnmpComponent(CamelContext camelContext,
+ SnmpComponentConfiguration configuration) throws Exception {
SnmpComponent component = new SnmpComponent();
component.setCamelContext(camelContext);
+ Map<String, Object> parameters = new HashMap<>();
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
+ for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+ Object value = entry.getValue();
+ Class<?> paramClass = value.getClass();
+ if (paramClass.getName().endsWith("NestedConfiguration")) {
+ Class nestedClass = null;
+ try {
+ nestedClass = (Class) paramClass.getDeclaredField(
+ "CAMEL_NESTED_CLASS").get(null);
+ HashMap<String, Object> nestedParameters = new HashMap<>();
+ IntrospectionSupport.getProperties(value, nestedParameters,
+ null, false);
+ Object nestedProperty = nestedClass.newInstance();
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), nestedProperty,
+ nestedParameters);
+ entry.setValue(nestedProperty);
+ } catch (NoSuchFieldException e) {
+ }
+ }
+ }
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), component, parameters);
return component;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-snmp-starter/src/main/java/org/apache/camel/component/snmp/springboot/SnmpComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-snmp-starter/src/main/java/org/apache/camel/component/snmp/springboot/SnmpComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-snmp-starter/src/main/java/org/apache/camel/component/snmp/springboot/SnmpComponentConfiguration.java
new file mode 100644
index 0000000..09aa366
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-snmp-starter/src/main/java/org/apache/camel/component/snmp/springboot/SnmpComponentConfiguration.java
@@ -0,0 +1,45 @@
+/**
+ * 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.snmp.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The snmp component gives you the ability to poll SNMP capable devices or
+ * receiving traps.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.snmp")
+public class SnmpComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-spark-starter/src/main/java/org/apache/camel/component/spark/springboot/SparkComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-spark-starter/src/main/java/org/apache/camel/component/spark/springboot/SparkComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-spark-starter/src/main/java/org/apache/camel/component/spark/springboot/SparkComponentConfiguration.java
index e107fbb..2d52a1f 100644
--- a/platforms/spring-boot/components-starter/camel-spark-starter/src/main/java/org/apache/camel/component/spark/springboot/SparkComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-spark-starter/src/main/java/org/apache/camel/component/spark/springboot/SparkComponentConfiguration.java
@@ -40,6 +40,12 @@ public class SparkComponentConfiguration {
*/
@NestedConfigurationProperty
private RddCallback rddCallback;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public JavaRDDLike getRdd() {
return rdd;
@@ -56,4 +62,13 @@ public class SparkComponentConfiguration {
public void setRddCallback(RddCallback rddCallback) {
this.rddCallback = rddCallback;
}
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-splunk-starter/src/main/java/org/apache/camel/component/splunk/springboot/SplunkComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-splunk-starter/src/main/java/org/apache/camel/component/splunk/springboot/SplunkComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-splunk-starter/src/main/java/org/apache/camel/component/splunk/springboot/SplunkComponentConfiguration.java
index d2c16e1..8e1d97b 100644
--- a/platforms/spring-boot/components-starter/camel-splunk-starter/src/main/java/org/apache/camel/component/splunk/springboot/SplunkComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-splunk-starter/src/main/java/org/apache/camel/component/splunk/springboot/SplunkComponentConfiguration.java
@@ -33,6 +33,12 @@ public class SplunkComponentConfiguration {
*/
@NestedConfigurationProperty
private SplunkConfigurationFactory splunkConfigurationFactory;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public SplunkConfigurationFactory getSplunkConfigurationFactory() {
return splunkConfigurationFactory;
@@ -42,4 +48,13 @@ public class SplunkComponentConfiguration {
SplunkConfigurationFactory splunkConfigurationFactory) {
this.splunkConfigurationFactory = splunkConfigurationFactory;
}
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-spring-batch-starter/src/main/java/org/apache/camel/component/spring/batch/springboot/SpringBatchComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-spring-batch-starter/src/main/java/org/apache/camel/component/spring/batch/springboot/SpringBatchComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-batch-starter/src/main/java/org/apache/camel/component/spring/batch/springboot/SpringBatchComponentConfiguration.java
index 1f45b84..4aff6a2 100644
--- a/platforms/spring-boot/components-starter/camel-spring-batch-starter/src/main/java/org/apache/camel/component/spring/batch/springboot/SpringBatchComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-spring-batch-starter/src/main/java/org/apache/camel/component/spring/batch/springboot/SpringBatchComponentConfiguration.java
@@ -40,6 +40,12 @@ public class SpringBatchComponentConfiguration {
*/
@NestedConfigurationProperty
private JobRegistry jobRegistry;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public JobLauncher getJobLauncher() {
return jobLauncher;
@@ -56,4 +62,13 @@ public class SpringBatchComponentConfiguration {
public void setJobRegistry(JobRegistry jobRegistry) {
this.jobRegistry = jobRegistry;
}
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/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 e0bf058..cb08a93 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.spring.integration.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.spring.integration.SpringIntegrationComponent;
+import org.apache.camel.util.IntrospectionSupport;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
@@ -26,6 +29,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.boot.bind.RelaxedPropertyResolver;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
@@ -40,6 +44,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(SpringIntegrationComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(SpringIntegrationComponentConfiguration.class)
public class SpringIntegrationComponentAutoConfiguration {
@Lazy
@@ -47,9 +52,36 @@ public class SpringIntegrationComponentAutoConfiguration {
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(SpringIntegrationComponent.class)
public SpringIntegrationComponent configureSpringIntegrationComponent(
- CamelContext camelContext) throws Exception {
+ CamelContext camelContext,
+ SpringIntegrationComponentConfiguration configuration)
+ throws Exception {
SpringIntegrationComponent component = new SpringIntegrationComponent();
component.setCamelContext(camelContext);
+ Map<String, Object> parameters = new HashMap<>();
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
+ for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+ Object value = entry.getValue();
+ Class<?> paramClass = value.getClass();
+ if (paramClass.getName().endsWith("NestedConfiguration")) {
+ Class nestedClass = null;
+ try {
+ nestedClass = (Class) paramClass.getDeclaredField(
+ "CAMEL_NESTED_CLASS").get(null);
+ HashMap<String, Object> nestedParameters = new HashMap<>();
+ IntrospectionSupport.getProperties(value, nestedParameters,
+ null, false);
+ Object nestedProperty = nestedClass.newInstance();
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), nestedProperty,
+ nestedParameters);
+ entry.setValue(nestedProperty);
+ } catch (NoSuchFieldException e) {
+ }
+ }
+ }
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), component, parameters);
return component;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentConfiguration.java
new file mode 100644
index 0000000..0cb2100
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-spring-integration-starter/src/main/java/org/apache/camel/component/spring/integration/springboot/SpringIntegrationComponentConfiguration.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.component.spring.integration.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * Bridges Camel with Spring Integration.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.spring-integration")
+public class SpringIntegrationComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/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 fef476d..c33a4f4 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.springldap.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.springldap.SpringLdapComponent;
+import org.apache.camel.util.IntrospectionSupport;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
@@ -26,6 +29,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.boot.bind.RelaxedPropertyResolver;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
@@ -40,6 +44,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(SpringLdapComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(SpringLdapComponentConfiguration.class)
public class SpringLdapComponentAutoConfiguration {
@Lazy
@@ -47,9 +52,35 @@ public class SpringLdapComponentAutoConfiguration {
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(SpringLdapComponent.class)
public SpringLdapComponent configureSpringLdapComponent(
- CamelContext camelContext) throws Exception {
+ CamelContext camelContext,
+ SpringLdapComponentConfiguration configuration) throws Exception {
SpringLdapComponent component = new SpringLdapComponent();
component.setCamelContext(camelContext);
+ Map<String, Object> parameters = new HashMap<>();
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
+ for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+ Object value = entry.getValue();
+ Class<?> paramClass = value.getClass();
+ if (paramClass.getName().endsWith("NestedConfiguration")) {
+ Class nestedClass = null;
+ try {
+ nestedClass = (Class) paramClass.getDeclaredField(
+ "CAMEL_NESTED_CLASS").get(null);
+ HashMap<String, Object> nestedParameters = new HashMap<>();
+ IntrospectionSupport.getProperties(value, nestedParameters,
+ null, false);
+ Object nestedProperty = nestedClass.newInstance();
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), nestedProperty,
+ nestedParameters);
+ entry.setValue(nestedProperty);
+ } catch (NoSuchFieldException e) {
+ }
+ }
+ }
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), component, parameters);
return component;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentConfiguration.java
new file mode 100644
index 0000000..a248515
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-spring-ldap-starter/src/main/java/org/apache/camel/component/springldap/springboot/SpringLdapComponentConfiguration.java
@@ -0,0 +1,45 @@
+/**
+ * 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.springldap.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The spring-ldap component allows you to perform searches in LDAP servers
+ * using filters as the message payload.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.spring-ldap")
+public class SpringLdapComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/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 66bd1be..25196fa 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.redis.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.redis.RedisComponent;
+import org.apache.camel.util.IntrospectionSupport;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
@@ -26,6 +29,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.boot.bind.RelaxedPropertyResolver;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
@@ -40,16 +44,42 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(RedisComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(RedisComponentConfiguration.class)
public class RedisComponentAutoConfiguration {
@Lazy
@Bean(name = "spring-redis-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(RedisComponent.class)
- public RedisComponent configureRedisComponent(CamelContext camelContext)
- throws Exception {
+ public RedisComponent configureRedisComponent(CamelContext camelContext,
+ RedisComponentConfiguration configuration) throws Exception {
RedisComponent component = new RedisComponent();
component.setCamelContext(camelContext);
+ Map<String, Object> parameters = new HashMap<>();
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
+ for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+ Object value = entry.getValue();
+ Class<?> paramClass = value.getClass();
+ if (paramClass.getName().endsWith("NestedConfiguration")) {
+ Class nestedClass = null;
+ try {
+ nestedClass = (Class) paramClass.getDeclaredField(
+ "CAMEL_NESTED_CLASS").get(null);
+ HashMap<String, Object> nestedParameters = new HashMap<>();
+ IntrospectionSupport.getProperties(value, nestedParameters,
+ null, false);
+ Object nestedProperty = nestedClass.newInstance();
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), nestedProperty,
+ nestedParameters);
+ entry.setValue(nestedProperty);
+ } catch (NoSuchFieldException e) {
+ }
+ }
+ }
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), component, parameters);
return component;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentConfiguration.java
new file mode 100644
index 0000000..be86162
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-spring-redis-starter/src/main/java/org/apache/camel/component/redis/springboot/RedisComponentConfiguration.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.component.redis.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The spring-redis component allows sending and receiving messages from Redis.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.spring-redis")
+public class RedisComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentConfiguration.java
index a2cc856..0628cb5 100644
--- a/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-spring-starter/src/main/java/org/apache/camel/component/event/springboot/EventComponentConfiguration.java
@@ -31,6 +31,12 @@ public class EventComponentConfiguration {
* The Spring ApplicationContext
*/
private ApplicationContext applicationContext;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public ApplicationContext getApplicationContext() {
return applicationContext;
@@ -39,4 +45,13 @@ public class EventComponentConfiguration {
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/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 ee5349b..42c56db 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.spring.ws.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.spring.ws.SpringWebserviceComponent;
+import org.apache.camel.util.IntrospectionSupport;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
@@ -26,6 +29,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.boot.bind.RelaxedPropertyResolver;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
@@ -40,6 +44,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(SpringWebserviceComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(SpringWebserviceComponentConfiguration.class)
public class SpringWebserviceComponentAutoConfiguration {
@Lazy
@@ -47,9 +52,36 @@ public class SpringWebserviceComponentAutoConfiguration {
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(SpringWebserviceComponent.class)
public SpringWebserviceComponent configureSpringWebserviceComponent(
- CamelContext camelContext) throws Exception {
+ CamelContext camelContext,
+ SpringWebserviceComponentConfiguration configuration)
+ throws Exception {
SpringWebserviceComponent component = new SpringWebserviceComponent();
component.setCamelContext(camelContext);
+ Map<String, Object> parameters = new HashMap<>();
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
+ for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+ Object value = entry.getValue();
+ Class<?> paramClass = value.getClass();
+ if (paramClass.getName().endsWith("NestedConfiguration")) {
+ Class nestedClass = null;
+ try {
+ nestedClass = (Class) paramClass.getDeclaredField(
+ "CAMEL_NESTED_CLASS").get(null);
+ HashMap<String, Object> nestedParameters = new HashMap<>();
+ IntrospectionSupport.getProperties(value, nestedParameters,
+ null, false);
+ Object nestedProperty = nestedClass.newInstance();
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), nestedProperty,
+ nestedParameters);
+ entry.setValue(nestedProperty);
+ } catch (NoSuchFieldException e) {
+ }
+ }
+ }
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), component, parameters);
return component;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentConfiguration.java
new file mode 100644
index 0000000..2282096
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-spring-ws-starter/src/main/java/org/apache/camel/component/spring/ws/springboot/SpringWebserviceComponentConfiguration.java
@@ -0,0 +1,45 @@
+/**
+ * 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.spring.ws.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The spring-ws component is used for SOAP WebServices using Spring
+ * WebServices.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.spring-ws")
+public class SpringWebserviceComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentConfiguration.java
index 5ce7925..99df47c 100644
--- a/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/springboot/SqlComponentConfiguration.java
@@ -36,6 +36,12 @@ public class SqlComponentConfiguration {
* with sign in the SQL queries. This option is default true
*/
private Boolean usePlaceholder = true;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public DataSource getDataSource() {
return dataSource;
@@ -52,4 +58,13 @@ public class SqlComponentConfiguration {
public void setUsePlaceholder(Boolean usePlaceholder) {
this.usePlaceholder = usePlaceholder;
}
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentConfiguration.java
index f4a0405..310d2d3 100644
--- a/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-sql-starter/src/main/java/org/apache/camel/component/sql/stored/springboot/SqlStoredComponentConfiguration.java
@@ -32,6 +32,12 @@ public class SqlStoredComponentConfiguration {
* Sets the DataSource to use to communicate with the database.
*/
private DataSource dataSource;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public DataSource getDataSource() {
return dataSource;
@@ -40,4 +46,13 @@ public class SqlStoredComponentConfiguration {
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
}
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentConfiguration.java
index db15ef6..3d59c0e 100644
--- a/platforms/spring-boot/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-ssh-starter/src/main/java/org/apache/camel/component/ssh/springboot/SshComponentConfiguration.java
@@ -86,6 +86,12 @@ public class SshComponentConfiguration {
* depends on keyType setting.
*/
private String certResource;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public SshConfigurationNestedConfiguration getConfiguration() {
return configuration;
@@ -179,6 +185,15 @@ public class SshComponentConfiguration {
this.certResource = certResource;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class SshConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.ssh.SshConfiguration.class;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/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 bee7380..752f57f 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.stax.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.stax.StAXComponent;
+import org.apache.camel.util.IntrospectionSupport;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
@@ -26,6 +29,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.boot.bind.RelaxedPropertyResolver;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
@@ -40,16 +44,42 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(StAXComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(StAXComponentConfiguration.class)
public class StAXComponentAutoConfiguration {
@Lazy
@Bean(name = "stax-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(StAXComponent.class)
- public StAXComponent configureStAXComponent(CamelContext camelContext)
- throws Exception {
+ public StAXComponent configureStAXComponent(CamelContext camelContext,
+ StAXComponentConfiguration configuration) throws Exception {
StAXComponent component = new StAXComponent();
component.setCamelContext(camelContext);
+ Map<String, Object> parameters = new HashMap<>();
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
+ for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+ Object value = entry.getValue();
+ Class<?> paramClass = value.getClass();
+ if (paramClass.getName().endsWith("NestedConfiguration")) {
+ Class nestedClass = null;
+ try {
+ nestedClass = (Class) paramClass.getDeclaredField(
+ "CAMEL_NESTED_CLASS").get(null);
+ HashMap<String, Object> nestedParameters = new HashMap<>();
+ IntrospectionSupport.getProperties(value, nestedParameters,
+ null, false);
+ Object nestedProperty = nestedClass.newInstance();
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), nestedProperty,
+ nestedParameters);
+ entry.setValue(nestedProperty);
+ } catch (NoSuchFieldException e) {
+ }
+ }
+ }
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), component, parameters);
return component;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentConfiguration.java
new file mode 100644
index 0000000..e82a27c
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-stax-starter/src/main/java/org/apache/camel/component/stax/springboot/StAXComponentConfiguration.java
@@ -0,0 +1,45 @@
+/**
+ * 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.stax.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The stax component allows messages to be process through a SAX
+ * ContentHandler.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.stax")
+public class StAXComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentConfiguration.java
index d324632..6fba01e 100644
--- a/platforms/spring-boot/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-stomp-starter/src/main/java/org/apache/camel/component/stomp/springboot/StompComponentConfiguration.java
@@ -49,6 +49,12 @@ public class StompComponentConfiguration {
* The virtual host
*/
private String host;
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
public StompConfigurationNestedConfiguration getConfiguration() {
return configuration;
@@ -91,6 +97,15 @@ public class StompComponentConfiguration {
this.host = host;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class StompConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.stomp.StompConfiguration.class;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/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 8f72be2..38e6716 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.stream.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.stream.StreamComponent;
+import org.apache.camel.util.IntrospectionSupport;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionMessage;
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
@@ -26,6 +29,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.boot.bind.RelaxedPropertyResolver;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Conditional;
@@ -40,16 +44,42 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration")
@Conditional(StreamComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(StreamComponentConfiguration.class)
public class StreamComponentAutoConfiguration {
@Lazy
@Bean(name = "stream-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(StreamComponent.class)
- public StreamComponent configureStreamComponent(CamelContext camelContext)
- throws Exception {
+ public StreamComponent configureStreamComponent(CamelContext camelContext,
+ StreamComponentConfiguration configuration) throws Exception {
StreamComponent component = new StreamComponent();
component.setCamelContext(camelContext);
+ Map<String, Object> parameters = new HashMap<>();
+ IntrospectionSupport.getProperties(configuration, parameters, null,
+ false);
+ for (Map.Entry<String, Object> entry : parameters.entrySet()) {
+ Object value = entry.getValue();
+ Class<?> paramClass = value.getClass();
+ if (paramClass.getName().endsWith("NestedConfiguration")) {
+ Class nestedClass = null;
+ try {
+ nestedClass = (Class) paramClass.getDeclaredField(
+ "CAMEL_NESTED_CLASS").get(null);
+ HashMap<String, Object> nestedParameters = new HashMap<>();
+ IntrospectionSupport.getProperties(value, nestedParameters,
+ null, false);
+ Object nestedProperty = nestedClass.newInstance();
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), nestedProperty,
+ nestedParameters);
+ entry.setValue(nestedProperty);
+ } catch (NoSuchFieldException e) {
+ }
+ }
+ }
+ IntrospectionSupport.setProperties(camelContext,
+ camelContext.getTypeConverter(), component, parameters);
return component;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-stream-starter/src/main/java/org/apache/camel/component/stream/springboot/StreamComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-stream-starter/src/main/java/org/apache/camel/component/stream/springboot/StreamComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-stream-starter/src/main/java/org/apache/camel/component/stream/springboot/StreamComponentConfiguration.java
new file mode 100644
index 0000000..eaa4aab
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-stream-starter/src/main/java/org/apache/camel/component/stream/springboot/StreamComponentConfiguration.java
@@ -0,0 +1,45 @@
+/**
+ * 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.stream.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The stream: component provides access to the system-in system-out and
+ * system-err streams as well as allowing streaming of file and URL.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.stream")
+public class StreamComponentConfiguration {
+
+ /**
+ * Whether the component should resolve property placeholders on itself when
+ * starting. Only properties which are of String type can use property
+ * placeholders.
+ */
+ private Boolean resolvePropertyPlaceholders = true;
+
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+}
\ No newline at end of file