http://git-wip-us.apache.org/repos/asf/camel/blob/c7907e9f/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/bean/springboot/BeanComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/bean/springboot/BeanComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/bean/springboot/BeanComponentConfiguration.java new file mode 100644 index 0000000..e037faf --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/bean/springboot/BeanComponentConfiguration.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.bean.springboot; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The bean component is for invoking Java beans from Camel. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.bean") +public class BeanComponentConfiguration { + + /** + * 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-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentAutoConfiguration.java index d75da6f..24dfb36 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentAutoConfiguration.java @@ -16,8 +16,11 @@ */ package org.apache.camel.component.beanclass.springboot; +import java.util.HashMap; +import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.beanclass.ClassComponent; +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(ClassComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(ClassComponentConfiguration.class) public class ClassComponentAutoConfiguration { @Lazy @Bean(name = "class-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean(ClassComponent.class) - public ClassComponent configureClassComponent(CamelContext camelContext) - throws Exception { + public ClassComponent configureClassComponent(CamelContext camelContext, + ClassComponentConfiguration configuration) throws Exception { ClassComponent component = new ClassComponent(); 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-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentConfiguration.java new file mode 100644 index 0000000..3f8eaac --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/beanclass/springboot/ClassComponentConfiguration.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.beanclass.springboot; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The Class Component is for invoking Java Classes (Java beans) from Camel. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.class") +public class ClassComponentConfiguration { + + /** + * 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-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentAutoConfiguration.java index ce78eb1..d07f676 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentAutoConfiguration.java @@ -16,8 +16,11 @@ */ package org.apache.camel.component.binding.springboot; +import java.util.HashMap; +import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.binding.BindingNameComponent; +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(BindingNameComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(BindingNameComponentConfiguration.class) public class BindingNameComponentAutoConfiguration { @Lazy @@ -47,9 +52,35 @@ public class BindingNameComponentAutoConfiguration { @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean(BindingNameComponent.class) public BindingNameComponent configureBindingNameComponent( - CamelContext camelContext) throws Exception { + CamelContext camelContext, + BindingNameComponentConfiguration configuration) throws Exception { BindingNameComponent component = new BindingNameComponent(); 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-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentConfiguration.java new file mode 100644 index 0000000..3af7275 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/binding/springboot/BindingNameComponentConfiguration.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.binding.springboot; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The binding component is used for as a of wrapping an Endpoint in a contract + * with a data format. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.binding") +public class BindingNameComponentConfiguration { + + /** + * 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-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentAutoConfiguration.java index 9aa85c0..db016c2 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentAutoConfiguration.java @@ -16,8 +16,11 @@ */ package org.apache.camel.component.browse.springboot; +import java.util.HashMap; +import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.browse.BrowseComponent; +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(BrowseComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(BrowseComponentConfiguration.class) public class BrowseComponentAutoConfiguration { @Lazy @Bean(name = "browse-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean(BrowseComponent.class) - public BrowseComponent configureBrowseComponent(CamelContext camelContext) - throws Exception { + public BrowseComponent configureBrowseComponent(CamelContext camelContext, + BrowseComponentConfiguration configuration) throws Exception { BrowseComponent component = new BrowseComponent(); 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-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentConfiguration.java new file mode 100644 index 0000000..7a2ccbf --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/browse/springboot/BrowseComponentConfiguration.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.browse.springboot; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The browse component is used for viewing the messages received on endpoints + * that supports BrowsableEndpoint. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.browse") +public class BrowseComponentConfiguration { + + /** + * 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-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java index d9a7aaa..d8ae2f9 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentAutoConfiguration.java @@ -16,8 +16,11 @@ */ package org.apache.camel.component.controlbus.springboot; +import java.util.HashMap; +import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.controlbus.ControlBusComponent; +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(ControlBusComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(ControlBusComponentConfiguration.class) public class ControlBusComponentAutoConfiguration { @Lazy @@ -47,9 +52,35 @@ public class ControlBusComponentAutoConfiguration { @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean(ControlBusComponent.class) public ControlBusComponent configureControlBusComponent( - CamelContext camelContext) throws Exception { + CamelContext camelContext, + ControlBusComponentConfiguration configuration) throws Exception { ControlBusComponent component = new ControlBusComponent(); 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-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentConfiguration.java new file mode 100644 index 0000000..7785337 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/controlbus/springboot/ControlBusComponentConfiguration.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.controlbus.springboot; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The controlbus component provides easy management of Camel applications based + * on the Control Bus EIP pattern. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.controlbus") +public class ControlBusComponentConfiguration { + + /** + * 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-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java index c574bdc..169c9fa 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentAutoConfiguration.java @@ -16,8 +16,11 @@ */ package org.apache.camel.component.dataformat.springboot; +import java.util.HashMap; +import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.dataformat.DataFormatComponent; +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(DataFormatComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(DataFormatComponentConfiguration.class) public class DataFormatComponentAutoConfiguration { @Lazy @@ -47,9 +52,35 @@ public class DataFormatComponentAutoConfiguration { @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean(DataFormatComponent.class) public DataFormatComponent configureDataFormatComponent( - CamelContext camelContext) throws Exception { + CamelContext camelContext, + DataFormatComponentConfiguration configuration) throws Exception { DataFormatComponent component = new DataFormatComponent(); 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-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentConfiguration.java new file mode 100644 index 0000000..9fa4663 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataformat/springboot/DataFormatComponentConfiguration.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.dataformat.springboot; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The dataformat component is used for working with Data Formats as if it was a + * regular Component supporting Endpoints and URIs. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.dataformat") +public class DataFormatComponentConfiguration { + + /** + * 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-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java index e3d205c..56fd9a3 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentAutoConfiguration.java @@ -16,8 +16,11 @@ */ package org.apache.camel.component.dataset.springboot; +import java.util.HashMap; +import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.dataset.DataSetComponent; +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,43 @@ import org.springframework.core.type.AnnotatedTypeMetadata; @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") @Conditional(DataSetComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(DataSetComponentConfiguration.class) public class DataSetComponentAutoConfiguration { @Lazy @Bean(name = "dataset-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean(DataSetComponent.class) - public DataSetComponent configureDataSetComponent(CamelContext camelContext) - throws Exception { + public DataSetComponent configureDataSetComponent( + CamelContext camelContext, + DataSetComponentConfiguration configuration) throws Exception { DataSetComponent component = new DataSetComponent(); 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-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentConfiguration.java new file mode 100644 index 0000000..5fe3fd2 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/dataset/springboot/DataSetComponentConfiguration.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.dataset.springboot; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The dataset component provides a mechanism to easily perform load & soak + * testing of your system. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.dataset") +public class DataSetComponentConfiguration { + + /** + * 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-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentConfiguration.java index 3187c0d..5110239 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/direct/springboot/DirectComponentConfiguration.java @@ -37,6 +37,12 @@ public class DirectComponentConfiguration { * The timeout value to use if block is enabled. */ private Long timeout = 30000L; + /** + * 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 getBlock() { return block; @@ -53,4 +59,13 @@ public class DirectComponentConfiguration { public void setTimeout(Long timeout) { this.timeout = timeout; } + + 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-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentConfiguration.java index 9b9de46..2f4383b 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/directvm/springboot/DirectVmComponentConfiguration.java @@ -51,6 +51,12 @@ public class DirectVmComponentConfiguration { * consumer side and vice versa. Default value: true. */ private Boolean propagateProperties = 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 Boolean getBlock() { return block; @@ -84,4 +90,13 @@ public class DirectVmComponentConfiguration { public void setPropagateProperties(Boolean propagateProperties) { this.propagateProperties = propagateProperties; } + + 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-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java index 8b82256..d0a4dfe 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentAutoConfiguration.java @@ -16,8 +16,11 @@ */ package org.apache.camel.component.file.springboot; +import java.util.HashMap; +import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.file.FileComponent; +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(FileComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(FileComponentConfiguration.class) public class FileComponentAutoConfiguration { @Lazy @Bean(name = "file-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean(FileComponent.class) - public FileComponent configureFileComponent(CamelContext camelContext) - throws Exception { + public FileComponent configureFileComponent(CamelContext camelContext, + FileComponentConfiguration configuration) throws Exception { FileComponent component = new FileComponent(); 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-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentConfiguration.java new file mode 100644 index 0000000..4171d86 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/file/springboot/FileComponentConfiguration.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.file.springboot; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The file component is used for reading or writing files. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.file") +public class FileComponentConfiguration { + + /** + * 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-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java index a67110a..d51b768 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentAutoConfiguration.java @@ -16,8 +16,11 @@ */ package org.apache.camel.component.language.springboot; +import java.util.HashMap; +import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.language.LanguageComponent; +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(LanguageComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(LanguageComponentConfiguration.class) public class LanguageComponentAutoConfiguration { @Lazy @@ -47,9 +52,35 @@ public class LanguageComponentAutoConfiguration { @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean(LanguageComponent.class) public LanguageComponent configureLanguageComponent( - CamelContext camelContext) throws Exception { + CamelContext camelContext, + LanguageComponentConfiguration configuration) throws Exception { LanguageComponent component = new LanguageComponent(); 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-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentConfiguration.java new file mode 100644 index 0000000..918f583 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/language/springboot/LanguageComponentConfiguration.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.language.springboot; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The language component allows you to send a message to an endpoint which + * executes a script by any of the supported Languages in Camel. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.language") +public class LanguageComponentConfiguration { + + /** + * 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-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentConfiguration.java index c7a8ecc..22b2301 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/log/springboot/LogComponentConfiguration.java @@ -35,6 +35,12 @@ public class LogComponentConfiguration { */ @NestedConfigurationProperty private ExchangeFormatter exchangeFormatter; + /** + * 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 ExchangeFormatter getExchangeFormatter() { return exchangeFormatter; @@ -43,4 +49,13 @@ public class LogComponentConfiguration { public void setExchangeFormatter(ExchangeFormatter exchangeFormatter) { this.exchangeFormatter = exchangeFormatter; } + + 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-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java index 73167f4..c112563 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentAutoConfiguration.java @@ -16,8 +16,11 @@ */ package org.apache.camel.component.mock.springboot; +import java.util.HashMap; +import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.mock.MockComponent; +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(MockComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(MockComponentConfiguration.class) public class MockComponentAutoConfiguration { @Lazy @Bean(name = "mock-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean(MockComponent.class) - public MockComponent configureMockComponent(CamelContext camelContext) - throws Exception { + public MockComponent configureMockComponent(CamelContext camelContext, + MockComponentConfiguration configuration) throws Exception { MockComponent component = new MockComponent(); 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-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentConfiguration.java new file mode 100644 index 0000000..dbed3e7 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/mock/springboot/MockComponentConfiguration.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.mock.springboot; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The mock component is used for testing routes and mediation rules using + * mocks. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.mock") +public class MockComponentConfiguration { + + /** + * 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-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentConfiguration.java index 0f16ccd..fcb8096 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/properties/springboot/PropertiesComponentConfiguration.java @@ -115,6 +115,12 @@ public class PropertiesComponentConfiguration { * Sets the system property mode. */ private Integer systemPropertiesMode = 2; + /** + * 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 List<PropertiesLocation> getLocations() { return locations; @@ -244,4 +250,13 @@ public class PropertiesComponentConfiguration { public void setSystemPropertiesMode(Integer systemPropertiesMode) { this.systemPropertiesMode = systemPropertiesMode; } + + 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-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java index c30907a..a02fd89 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentAutoConfiguration.java @@ -16,8 +16,11 @@ */ package org.apache.camel.component.ref.springboot; +import java.util.HashMap; +import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.ref.RefComponent; +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(RefComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(RefComponentConfiguration.class) public class RefComponentAutoConfiguration { @Lazy @Bean(name = "ref-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean(RefComponent.class) - public RefComponent configureRefComponent(CamelContext camelContext) - throws Exception { + public RefComponent configureRefComponent(CamelContext camelContext, + RefComponentConfiguration configuration) throws Exception { RefComponent component = new RefComponent(); 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-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentConfiguration.java new file mode 100644 index 0000000..76b8a2d --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/ref/springboot/RefComponentConfiguration.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.ref.springboot; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The ref component is used for lookup of existing endpoints bound in the + * Registry. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.ref") +public class RefComponentConfiguration { + + /** + * 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-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java index 2567fb7..b345085 100644 --- a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentAutoConfiguration.java @@ -16,8 +16,11 @@ */ package org.apache.camel.component.rest.springboot; +import java.util.HashMap; +import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.component.rest.RestApiComponent; +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,43 @@ import org.springframework.core.type.AnnotatedTypeMetadata; @ConditionalOnBean(type = "org.apache.camel.spring.boot.CamelAutoConfiguration") @Conditional(RestApiComponentAutoConfiguration.Condition.class) @AutoConfigureAfter(name = "org.apache.camel.spring.boot.CamelAutoConfiguration") +@EnableConfigurationProperties(RestApiComponentConfiguration.class) public class RestApiComponentAutoConfiguration { @Lazy @Bean(name = "rest-api-component") @ConditionalOnClass(CamelContext.class) @ConditionalOnMissingBean(RestApiComponent.class) - public RestApiComponent configureRestApiComponent(CamelContext camelContext) - throws Exception { + public RestApiComponent configureRestApiComponent( + CamelContext camelContext, + RestApiComponentConfiguration configuration) throws Exception { RestApiComponent component = new RestApiComponent(); 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-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentConfiguration.java new file mode 100644 index 0000000..23e05e6 --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-core-starter/src/main/java/org/apache/camel/component/rest/springboot/RestApiComponentConfiguration.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.rest.springboot; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * The rest-api component is used for providing Swagger API of the REST services + * which has been defined using the rest-dsl in Camel. + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@ConfigurationProperties(prefix = "camel.component.rest-api") +public class RestApiComponentConfiguration { + + /** + * 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