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:06 UTC
[05/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-jdbc-starter/src/main/java/org/apache/camel/component/jdbc/springboot/JdbcComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jdbc-starter/src/main/java/org/apache/camel/component/jdbc/springboot/JdbcComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-jdbc-starter/src/main/java/org/apache/camel/component/jdbc/springboot/JdbcComponentConfiguration.java
index a4be1f6..49df11b 100644
--- a/platforms/spring-boot/components-starter/camel-jdbc-starter/src/main/java/org/apache/camel/component/jdbc/springboot/JdbcComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jdbc-starter/src/main/java/org/apache/camel/component/jdbc/springboot/JdbcComponentConfiguration.java
@@ -33,6 +33,12 @@ public class JdbcComponentConfiguration {
* name from the registry.
*/
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;
@@ -41,4 +47,13 @@ public class JdbcComponentConfiguration {
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-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentConfiguration9.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentConfiguration9.java b/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentConfiguration9.java
index 6b7487b..dbfb880 100644
--- a/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentConfiguration9.java
+++ b/platforms/spring-boot/components-starter/camel-jetty9-starter/src/main/java/org/apache/camel/component/jetty9/springboot/JettyHttpComponentConfiguration9.java
@@ -201,6 +201,12 @@ public class JettyHttpComponentConfiguration9 {
*/
@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 getSslKeyPassword() {
return sslKeyPassword;
@@ -454,4 +460,13 @@ public class JettyHttpComponentConfiguration9 {
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-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/JGroupsComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/JGroupsComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/JGroupsComponentConfiguration.java
index 4c34358..1f03ffd 100644
--- a/platforms/spring-boot/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/JGroupsComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/JGroupsComponentConfiguration.java
@@ -44,6 +44,12 @@ public class JGroupsComponentConfiguration {
* only regular messages are consumed by the endpoint.
*/
private Boolean enableViewMessages = false;
+ /**
+ * 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 Channel getChannel() {
return channel;
@@ -68,4 +74,13 @@ public class JGroupsComponentConfiguration {
public void setEnableViewMessages(Boolean enableViewMessages) {
this.enableViewMessages = enableViewMessages;
}
+
+ 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-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 b318b2c..8277809 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.validator.jing.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.validator.jing.JingComponent;
+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(JingComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(JingComponentConfiguration.class)
public class JingComponentAutoConfiguration {
@Lazy
@Bean(name = "jing-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JingComponent.class)
- public JingComponent configureJingComponent(CamelContext camelContext)
- throws Exception {
+ public JingComponent configureJingComponent(CamelContext camelContext,
+ JingComponentConfiguration configuration) throws Exception {
JingComponent component = new JingComponent();
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-jing-starter/src/main/java/org/apache/camel/component/validator/jing/springboot/JingComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jing-starter/src/main/java/org/apache/camel/component/validator/jing/springboot/JingComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-jing-starter/src/main/java/org/apache/camel/component/validator/jing/springboot/JingComponentConfiguration.java
new file mode 100644
index 0000000..78fbd75
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-jing-starter/src/main/java/org/apache/camel/component/validator/jing/springboot/JingComponentConfiguration.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.validator.jing.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * Validates the payload of a message using RelaxNG Syntax using Jing library.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.jing")
+public class JingComponentConfiguration {
+
+ /**
+ * 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-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 a40a8c1..24d5696 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.jira.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.jira.JIRAComponent;
+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(JIRAComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(JIRAComponentConfiguration.class)
public class JIRAComponentAutoConfiguration {
@Lazy
@Bean(name = "jira-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JIRAComponent.class)
- public JIRAComponent configureJIRAComponent(CamelContext camelContext)
- throws Exception {
+ public JIRAComponent configureJIRAComponent(CamelContext camelContext,
+ JIRAComponentConfiguration configuration) throws Exception {
JIRAComponent component = new JIRAComponent();
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-jira-starter/src/main/java/org/apache/camel/component/jira/springboot/JIRAComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jira-starter/src/main/java/org/apache/camel/component/jira/springboot/JIRAComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-jira-starter/src/main/java/org/apache/camel/component/jira/springboot/JIRAComponentConfiguration.java
new file mode 100644
index 0000000..2222418
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-jira-starter/src/main/java/org/apache/camel/component/jira/springboot/JIRAComponentConfiguration.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.jira.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The jira component interacts with the JIRA issue tracker.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.jira")
+public class JIRAComponentConfiguration {
+
+ /**
+ * 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-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
index d01e5af..607335b 100644
--- a/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java
@@ -569,6 +569,12 @@ public class JmsComponentConfiguration {
*/
@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 JmsConfigurationNestedConfiguration getConfiguration() {
return configuration;
@@ -1188,6 +1194,15 @@ public class JmsComponentConfiguration {
this.headerFilterStrategy = headerFilterStrategy;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class JmsConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.jms.JmsConfiguration.class;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/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 2230be6..e140a2d 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.jmx.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.jmx.JMXComponent;
+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(JMXComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(JMXComponentConfiguration.class)
public class JMXComponentAutoConfiguration {
@Lazy
@Bean(name = "jmx-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JMXComponent.class)
- public JMXComponent configureJMXComponent(CamelContext camelContext)
- throws Exception {
+ public JMXComponent configureJMXComponent(CamelContext camelContext,
+ JMXComponentConfiguration configuration) throws Exception {
JMXComponent component = new JMXComponent();
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-jmx-starter/src/main/java/org/apache/camel/component/jmx/springboot/JMXComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jmx-starter/src/main/java/org/apache/camel/component/jmx/springboot/JMXComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-jmx-starter/src/main/java/org/apache/camel/component/jmx/springboot/JMXComponentConfiguration.java
new file mode 100644
index 0000000..295b701
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-jmx-starter/src/main/java/org/apache/camel/component/jmx/springboot/JMXComponentConfiguration.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.jmx.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The jmx component allows to receive JMX notifications.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.jmx")
+public class JMXComponentConfiguration {
+
+ /**
+ * 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-jolt-starter/src/main/java/org/apache/camel/component/jolt/springboot/JoltComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jolt-starter/src/main/java/org/apache/camel/component/jolt/springboot/JoltComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-jolt-starter/src/main/java/org/apache/camel/component/jolt/springboot/JoltComponentConfiguration.java
index 0322b23..c14d949 100644
--- a/platforms/spring-boot/components-starter/camel-jolt-starter/src/main/java/org/apache/camel/component/jolt/springboot/JoltComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jolt-starter/src/main/java/org/apache/camel/component/jolt/springboot/JoltComponentConfiguration.java
@@ -35,6 +35,12 @@ public class JoltComponentConfiguration {
*/
@NestedConfigurationProperty
private Transform transform;
+ /**
+ * 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 Transform getTransform() {
return transform;
@@ -43,4 +49,13 @@ public class JoltComponentConfiguration {
public void setTransform(Transform transform) {
this.transform = transform;
}
+
+ 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-jpa-starter/src/main/java/org/apache/camel/component/jpa/springboot/JpaComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jpa-starter/src/main/java/org/apache/camel/component/jpa/springboot/JpaComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-jpa-starter/src/main/java/org/apache/camel/component/jpa/springboot/JpaComponentConfiguration.java
index 6b2a7b4..ed73738 100644
--- a/platforms/spring-boot/components-starter/camel-jpa-starter/src/main/java/org/apache/camel/component/jpa/springboot/JpaComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jpa-starter/src/main/java/org/apache/camel/component/jpa/springboot/JpaComponentConfiguration.java
@@ -54,6 +54,12 @@ public class JpaComponentConfiguration {
* an EXTENDED EntityManager.
*/
private Boolean sharedEntityManager = false;
+ /**
+ * 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 EntityManagerFactory getEntityManagerFactory() {
return entityManagerFactory;
@@ -88,4 +94,13 @@ public class JpaComponentConfiguration {
public void setSharedEntityManager(Boolean sharedEntityManager) {
this.sharedEntityManager = sharedEntityManager;
}
+
+ 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-jsch-starter/src/main/java/org/apache/camel/component/scp/springboot/ScpComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jsch-starter/src/main/java/org/apache/camel/component/scp/springboot/ScpComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-jsch-starter/src/main/java/org/apache/camel/component/scp/springboot/ScpComponentConfiguration.java
index f843bdc..5ec146c 100644
--- a/platforms/spring-boot/components-starter/camel-jsch-starter/src/main/java/org/apache/camel/component/scp/springboot/ScpComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jsch-starter/src/main/java/org/apache/camel/component/scp/springboot/ScpComponentConfiguration.java
@@ -32,6 +32,12 @@ public class ScpComponentConfiguration {
* on the verbose logging again.
*/
private Boolean verboseLogging = false;
+ /**
+ * 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 getVerboseLogging() {
return verboseLogging;
@@ -40,4 +46,13 @@ public class ScpComponentConfiguration {
public void setVerboseLogging(Boolean verboseLogging) {
this.verboseLogging = verboseLogging;
}
+
+ 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-jt400-starter/src/main/java/org/apache/camel/component/jt400/springboot/Jt400ComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-jt400-starter/src/main/java/org/apache/camel/component/jt400/springboot/Jt400ComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-jt400-starter/src/main/java/org/apache/camel/component/jt400/springboot/Jt400ComponentConfiguration.java
index c72a44c..1da21d4 100644
--- a/platforms/spring-boot/components-starter/camel-jt400-starter/src/main/java/org/apache/camel/component/jt400/springboot/Jt400ComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-jt400-starter/src/main/java/org/apache/camel/component/jt400/springboot/Jt400ComponentConfiguration.java
@@ -34,6 +34,12 @@ public class Jt400ComponentConfiguration {
*/
@NestedConfigurationProperty
private AS400ConnectionPool connectionPool;
+ /**
+ * 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 AS400ConnectionPool getConnectionPool() {
return connectionPool;
@@ -42,4 +48,13 @@ public class Jt400ComponentConfiguration {
public void setConnectionPool(AS400ConnectionPool connectionPool) {
this.connectionPool = connectionPool;
}
+
+ 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-kafka-starter/src/main/java/org/apache/camel/component/kafka/springboot/KafkaComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-kafka-starter/src/main/java/org/apache/camel/component/kafka/springboot/KafkaComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-kafka-starter/src/main/java/org/apache/camel/component/kafka/springboot/KafkaComponentConfiguration.java
index 3396544..1a70239 100644
--- a/platforms/spring-boot/components-starter/camel-kafka-starter/src/main/java/org/apache/camel/component/kafka/springboot/KafkaComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-kafka-starter/src/main/java/org/apache/camel/component/kafka/springboot/KafkaComponentConfiguration.java
@@ -43,6 +43,12 @@ public class KafkaComponentConfiguration {
* pool down when no longer needed.
*/
private ExecutorService workerPool;
+ /**
+ * 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 getBrokers() {
return brokers;
@@ -59,4 +65,13 @@ public class KafkaComponentConfiguration {
public void setWorkerPool(ExecutorService workerPool) {
this.workerPool = workerPool;
}
+
+ 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-kestrel-starter/src/main/java/org/apache/camel/component/kestrel/springboot/KestrelComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-kestrel-starter/src/main/java/org/apache/camel/component/kestrel/springboot/KestrelComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-kestrel-starter/src/main/java/org/apache/camel/component/kestrel/springboot/KestrelComponentConfiguration.java
index ae17c4d..f577514 100644
--- a/platforms/spring-boot/components-starter/camel-kestrel-starter/src/main/java/org/apache/camel/component/kestrel/springboot/KestrelComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-kestrel-starter/src/main/java/org/apache/camel/component/kestrel/springboot/KestrelComponentConfiguration.java
@@ -32,6 +32,12 @@ public class KestrelComponentConfiguration {
* endpoints.
*/
private KestrelConfigurationNestedConfiguration 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 KestrelConfigurationNestedConfiguration getConfiguration() {
return configuration;
@@ -42,6 +48,15 @@ public class KestrelComponentConfiguration {
this.configuration = configuration;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class KestrelConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.kestrel.KestrelConfiguration.class;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/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 9930712..7644da8 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.krati.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.krati.KratiComponent;
+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(KratiComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(KratiComponentConfiguration.class)
public class KratiComponentAutoConfiguration {
@Lazy
@Bean(name = "krati-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(KratiComponent.class)
- public KratiComponent configureKratiComponent(CamelContext camelContext)
- throws Exception {
+ public KratiComponent configureKratiComponent(CamelContext camelContext,
+ KratiComponentConfiguration configuration) throws Exception {
KratiComponent component = new KratiComponent();
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-krati-starter/src/main/java/org/apache/camel/component/krati/springboot/KratiComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-krati-starter/src/main/java/org/apache/camel/component/krati/springboot/KratiComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-krati-starter/src/main/java/org/apache/camel/component/krati/springboot/KratiComponentConfiguration.java
new file mode 100644
index 0000000..077c67a
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-krati-starter/src/main/java/org/apache/camel/component/krati/springboot/KratiComponentConfiguration.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.krati.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The krati allows the use krati datastores and datasets inside Camel.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.krati")
+public class KratiComponentConfiguration {
+
+ /**
+ * 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-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 c3b5545..13f802a 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.kubernetes.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.kubernetes.KubernetesComponent;
+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(KubernetesComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(KubernetesComponentConfiguration.class)
public class KubernetesComponentAutoConfiguration {
@Lazy
@@ -47,9 +52,35 @@ public class KubernetesComponentAutoConfiguration {
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(KubernetesComponent.class)
public KubernetesComponent configureKubernetesComponent(
- CamelContext camelContext) throws Exception {
+ CamelContext camelContext,
+ KubernetesComponentConfiguration configuration) throws Exception {
KubernetesComponent component = new KubernetesComponent();
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-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/KubernetesComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/KubernetesComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/KubernetesComponentConfiguration.java
new file mode 100644
index 0000000..a7a9e08
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/KubernetesComponentConfiguration.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.kubernetes.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The kubernetes component allows to work with Kubernetes PaaS.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.kubernetes")
+public class KubernetesComponentConfiguration {
+
+ /**
+ * 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-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 9a541be..797f03b 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.ldap.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.ldap.LdapComponent;
+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(LdapComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(LdapComponentConfiguration.class)
public class LdapComponentAutoConfiguration {
@Lazy
@Bean(name = "ldap-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(LdapComponent.class)
- public LdapComponent configureLdapComponent(CamelContext camelContext)
- throws Exception {
+ public LdapComponent configureLdapComponent(CamelContext camelContext,
+ LdapComponentConfiguration configuration) throws Exception {
LdapComponent component = new LdapComponent();
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-ldap-starter/src/main/java/org/apache/camel/component/ldap/springboot/LdapComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-ldap-starter/src/main/java/org/apache/camel/component/ldap/springboot/LdapComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-ldap-starter/src/main/java/org/apache/camel/component/ldap/springboot/LdapComponentConfiguration.java
new file mode 100644
index 0000000..dff0de6
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-ldap-starter/src/main/java/org/apache/camel/component/ldap/springboot/LdapComponentConfiguration.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.ldap.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * The 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.ldap")
+public class LdapComponentConfiguration {
+
+ /**
+ * 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-linkedin-starter/src/main/java/org/apache/camel/component/linkedin/springboot/LinkedInComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-linkedin-starter/src/main/java/org/apache/camel/component/linkedin/springboot/LinkedInComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-linkedin-starter/src/main/java/org/apache/camel/component/linkedin/springboot/LinkedInComponentConfiguration.java
index a7c5f63..56c5bbd 100644
--- a/platforms/spring-boot/components-starter/camel-linkedin-starter/src/main/java/org/apache/camel/component/linkedin/springboot/LinkedInComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-linkedin-starter/src/main/java/org/apache/camel/component/linkedin/springboot/LinkedInComponentConfiguration.java
@@ -35,6 +35,12 @@ public class LinkedInComponentConfiguration {
* To use the shared configuration
*/
private LinkedInConfigurationNestedConfiguration 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 LinkedInConfigurationNestedConfiguration getConfiguration() {
return configuration;
@@ -45,6 +51,15 @@ public class LinkedInComponentConfiguration {
this.configuration = configuration;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class LinkedInConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.linkedin.LinkedInConfiguration.class;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-lucene-starter/src/main/java/org/apache/camel/component/lucene/springboot/LuceneComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-lucene-starter/src/main/java/org/apache/camel/component/lucene/springboot/LuceneComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-lucene-starter/src/main/java/org/apache/camel/component/lucene/springboot/LuceneComponentConfiguration.java
index a6ac5bb..25aaf95 100644
--- a/platforms/spring-boot/components-starter/camel-lucene-starter/src/main/java/org/apache/camel/component/lucene/springboot/LuceneComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-lucene-starter/src/main/java/org/apache/camel/component/lucene/springboot/LuceneComponentConfiguration.java
@@ -36,6 +36,12 @@ public class LuceneComponentConfiguration {
* To use a shared lucene configuration
*/
private LuceneConfigurationNestedConfiguration config;
+ /**
+ * 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 LuceneConfigurationNestedConfiguration getConfig() {
return config;
@@ -45,6 +51,15 @@ public class LuceneComponentConfiguration {
this.config = config;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class LuceneConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.lucene.LuceneConfiguration.class;
private URI uri;
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-lumberjack-starter/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-lumberjack-starter/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-lumberjack-starter/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentConfiguration.java
index e563fe9..8c9b251 100644
--- a/platforms/spring-boot/components-starter/camel-lumberjack-starter/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-lumberjack-starter/src/main/java/org/apache/camel/component/lumberjack/springboot/LumberjackComponentConfiguration.java
@@ -35,6 +35,12 @@ public class LumberjackComponentConfiguration {
*/
@NestedConfigurationProperty
private SSLContextParameters sslContextParameters;
+ /**
+ * 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 SSLContextParameters getSslContextParameters() {
return sslContextParameters;
@@ -44,4 +50,13 @@ public class LumberjackComponentConfiguration {
SSLContextParameters sslContextParameters) {
this.sslContextParameters = sslContextParameters;
}
+
+ 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-mail-starter/src/main/java/org/apache/camel/component/mail/springboot/MailComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/component/mail/springboot/MailComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/component/mail/springboot/MailComponentConfiguration.java
index 5cc29b7..6937ee2 100644
--- a/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/component/mail/springboot/MailComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-mail-starter/src/main/java/org/apache/camel/component/mail/springboot/MailComponentConfiguration.java
@@ -42,6 +42,12 @@ public class MailComponentConfiguration {
*/
@NestedConfigurationProperty
private ContentTypeResolver contentTypeResolver;
+ /**
+ * 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 MailConfigurationNestedConfiguration getConfiguration() {
return configuration;
@@ -60,6 +66,15 @@ public class MailComponentConfiguration {
this.contentTypeResolver = contentTypeResolver;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class MailConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.mail.MailConfiguration.class;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-metrics-starter/src/main/java/org/apache/camel/component/metrics/springboot/MetricsComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-metrics-starter/src/main/java/org/apache/camel/component/metrics/springboot/MetricsComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-metrics-starter/src/main/java/org/apache/camel/component/metrics/springboot/MetricsComponentConfiguration.java
index a8ef666..6c2306b 100644
--- a/platforms/spring-boot/components-starter/camel-metrics-starter/src/main/java/org/apache/camel/component/metrics/springboot/MetricsComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-metrics-starter/src/main/java/org/apache/camel/component/metrics/springboot/MetricsComponentConfiguration.java
@@ -34,6 +34,12 @@ public class MetricsComponentConfiguration {
*/
@NestedConfigurationProperty
private MetricRegistry metricRegistry;
+ /**
+ * 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 MetricRegistry getMetricRegistry() {
return metricRegistry;
@@ -42,4 +48,13 @@ public class MetricsComponentConfiguration {
public void setMetricRegistry(MetricRegistry metricRegistry) {
this.metricRegistry = metricRegistry;
}
+
+ 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-mina2-starter/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mina2-starter/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-mina2-starter/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentConfiguration.java
index 9ebc627..997189e 100644
--- a/platforms/spring-boot/components-starter/camel-mina2-starter/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-mina2-starter/src/main/java/org/apache/camel/component/mina2/springboot/Mina2ComponentConfiguration.java
@@ -37,6 +37,12 @@ public class Mina2ComponentConfiguration {
* To use the shared mina configuration.
*/
private Mina2ConfigurationNestedConfiguration 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 Mina2ConfigurationNestedConfiguration getConfiguration() {
return configuration;
@@ -47,6 +53,15 @@ public class Mina2ComponentConfiguration {
this.configuration = configuration;
}
+ public Boolean getResolvePropertyPlaceholders() {
+ return resolvePropertyPlaceholders;
+ }
+
+ public void setResolvePropertyPlaceholders(
+ Boolean resolvePropertyPlaceholders) {
+ this.resolvePropertyPlaceholders = resolvePropertyPlaceholders;
+ }
+
public static class Mina2ConfigurationNestedConfiguration {
public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.mina2.Mina2Configuration.class;
/**
http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/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 1386dd4..be286a1 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.mllp.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.mllp.MllpComponent;
+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(MllpComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(MllpComponentConfiguration.class)
public class MllpComponentAutoConfiguration {
@Lazy
@Bean(name = "mllp-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(MllpComponent.class)
- public MllpComponent configureMllpComponent(CamelContext camelContext)
- throws Exception {
+ public MllpComponent configureMllpComponent(CamelContext camelContext,
+ MllpComponentConfiguration configuration) throws Exception {
MllpComponent component = new MllpComponent();
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-mllp-starter/src/main/java/org/apache/camel/component/mllp/springboot/MllpComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mllp-starter/src/main/java/org/apache/camel/component/mllp/springboot/MllpComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-mllp-starter/src/main/java/org/apache/camel/component/mllp/springboot/MllpComponentConfiguration.java
new file mode 100644
index 0000000..3cd81cb
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-mllp-starter/src/main/java/org/apache/camel/component/mllp/springboot/MllpComponentConfiguration.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.mllp.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * Provides functionality required by Healthcare providers to communicate with
+ * other systems using the MLLP protocol.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.mllp")
+public class MllpComponentConfiguration {
+
+ /**
+ * 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-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 4ee9881..a55b690 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
@@ -16,8 +16,11 @@
*/
package org.apache.camel.component.mongodb.gridfs.springboot;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.component.mongodb.gridfs.GridFsComponent;
+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(GridFsComponentAutoConfiguration.Condition.class)
@AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration")
+@EnableConfigurationProperties(GridFsComponentConfiguration.class)
public class GridFsComponentAutoConfiguration {
@Lazy
@Bean(name = "mongodb-gridfs-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(GridFsComponent.class)
- public GridFsComponent configureGridFsComponent(CamelContext camelContext)
- throws Exception {
+ public GridFsComponent configureGridFsComponent(CamelContext camelContext,
+ GridFsComponentConfiguration configuration) throws Exception {
GridFsComponent component = new GridFsComponent();
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-mongodb-gridfs-starter/src/main/java/org/apache/camel/component/mongodb/gridfs/springboot/GridFsComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-mongodb-gridfs-starter/src/main/java/org/apache/camel/component/mongodb/gridfs/springboot/GridFsComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-mongodb-gridfs-starter/src/main/java/org/apache/camel/component/mongodb/gridfs/springboot/GridFsComponentConfiguration.java
new file mode 100644
index 0000000..5ae07dd
--- /dev/null
+++ b/platforms/spring-boot/components-starter/camel-mongodb-gridfs-starter/src/main/java/org/apache/camel/component/mongodb/gridfs/springboot/GridFsComponentConfiguration.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.mongodb.gridfs.springboot;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * Component for working with MongoDB GridFS.
+ *
+ * Generated by camel-package-maven-plugin - do not edit this file!
+ */
+@ConfigurationProperties(prefix = "camel.component.mongodb-gridfs")
+public class GridFsComponentConfiguration {
+
+ /**
+ * 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