This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push: new b83d2b59771 CAMEL-19090: Remove deprecated apis in core b83d2b59771 is described below commit b83d2b5977160a46cf703bb0298fef994dd28e45 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Fri Mar 3 14:14:12 2023 +0100 CAMEL-19090: Remove deprecated apis in core --- .../springboot/catalog/languages/xtokenize.json | 4 ++-- .../ConsulServiceDiscoveryAutoConfiguration.java | 15 +++++++------- .../ConsulServiceRegistryAutoConfiguration.java | 13 +++++++----- .../cloud/ConsulServiceRegistryConfiguration.java | 1 + .../ConsulClusterServiceAutoConfiguration.java | 12 ++++++----- .../cluster/ConsulClusterServiceConfiguration.java | 1 + ...stConfigurationDefinitionAutoConfiguration.java | 3 +-- .../cloud/DnsCloudAutoConfiguration.java | 15 +++++++------- ...JGroupsRaftClusterServiceAutoConfiguration.java | 13 +++++++----- .../JGroupsRaftClusterServiceConfiguration.java | 1 + ...JGroupsLockClusterServiceAutoConfiguration.java | 13 +++++++----- ...ubernetesServiceDiscoveryAutoConfiguration.java | 15 +++++++------- .../KubernetesClusterServiceAutoConfiguration.java | 13 +++++++----- .../springboot/LraServiceAutoConfiguration.java | 5 ----- .../springboot/ResilienceAutoConfiguration.java | 13 +++++++----- .../camel-stax-starter/src/main/docs/stax.json | 3 ++- .../XMLTokenizeLanguageConfiguration.java | 2 +- .../ZooKeeperServiceRegistryAutoConfiguration.java | 13 +++++++----- .../ZooKeeperServiceRegistryConfiguration.java | 1 + .../ZooKeeperClusterServiceAutoConfiguration.java | 13 +++++++----- .../spring/boot/util/CamelPropertiesHelper.java | 23 +++++++++++++++++++--- .../maven/SpringBootAutoConfigurationMojo.java | 3 +-- 22 files changed, 115 insertions(+), 80 deletions(-) diff --git a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/languages/xtokenize.json b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/languages/xtokenize.json index 6d8a16a1456..b257e5d4b7f 100644 --- a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/languages/xtokenize.json +++ b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/languages/xtokenize.json @@ -16,8 +16,8 @@ "modelJavaType": "org.apache.camel.model.language.XMLTokenizerExpression" }, "properties": { - "mode": { "kind": "attribute", "displayName": "Mode", "label": "advanced", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "i", "w", "u", "t" ], "deprecated": false, "autowired": false, "secret": false, "description": "The extraction mode. The available extraction modes are: i - injecting the contextual namespace bindings into the extracted token (default) w - wrapping the extracted token in its ancestor context u - unwrapping the extracted token to its c [...] - "group": { "kind": "attribute", "displayName": "Group", "label": "advanced", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "description": "To group N parts together" }, + "mode": { "kind": "attribute", "displayName": "Mode", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "i", "w", "u", "t" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "i", "description": "The extraction mode. The available extraction modes are: i - injecting the contextual namespace bindings into the extracted token (default) w - wrapping the extracted token in its ancestor context u - unwrapping the extracted token to its c [...] + "group": { "kind": "attribute", "displayName": "Group", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "description": "To group N parts together" }, "namespace": { "kind": "element", "displayName": "Namespace", "label": "common", "required": false, "type": "array", "javaType": "java.util.List<org.apache.camel.model.PropertyDefinition>", "deprecated": false, "autowired": false, "secret": false, "description": "Injects the XML Namespaces of prefix - uri mappings" }, "headerName": { "kind": "attribute", "displayName": "Header Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of header to use as input, instead of the message body It has as higher precedent than the propertyName if both are set." }, "propertyName": { "kind": "attribute", "displayName": "Property Name", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Name of property to use as input, instead of the message body. It has a lower precedent than the headerName if both are set." }, diff --git a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cloud/ConsulServiceDiscoveryAutoConfiguration.java b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cloud/ConsulServiceDiscoveryAutoConfiguration.java index f1c032c7e9f..275473e388c 100644 --- a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cloud/ConsulServiceDiscoveryAutoConfiguration.java +++ b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cloud/ConsulServiceDiscoveryAutoConfiguration.java @@ -26,9 +26,10 @@ import org.apache.camel.cloud.ServiceDiscovery; import org.apache.camel.component.consul.cloud.ConsulServiceDiscoveryFactory; import org.apache.camel.model.cloud.springboot.ConsulServiceCallServiceDiscoveryConfigurationCommon; import org.apache.camel.model.cloud.springboot.ConsulServiceCallServiceDiscoveryConfigurationProperties; +import org.apache.camel.spi.BeanIntrospection; import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; import org.apache.camel.spring.boot.util.GroupCondition; -import org.apache.camel.support.IntrospectionSupport; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -58,11 +59,8 @@ public class ConsulServiceDiscoveryAutoConfiguration { public ServiceDiscovery configureServiceDiscoveryFactory() throws Exception { ConsulServiceDiscoveryFactory factory = new ConsulServiceDiscoveryFactory(); - IntrospectionSupport.setProperties( - camelContext, - camelContext.getTypeConverter(), - factory, - IntrospectionSupport.getNonNullProperties(configuration)); + CamelPropertiesHelper.setCamelProperties(camelContext, factory, + CamelPropertiesHelper.getNonNullProperties(camelContext, configuration), false); return factory.newInstance(camelContext); } @@ -79,9 +77,10 @@ public class ConsulServiceDiscoveryAutoConfiguration { // The instance factory ConsulServiceDiscoveryFactory factory = new ConsulServiceDiscoveryFactory(); + BeanIntrospection bi = camelContext.getCamelContextExtension().getBeanIntrospection(); try { - IntrospectionSupport.getProperties(entry.getValue(), parameters, null, false); - IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), factory, parameters); + bi.getProperties(entry.getValue(), parameters, null, false); + CamelPropertiesHelper.setCamelProperties(camelContext, factory, parameters, false); beanFactory.registerSingleton(entry.getKey(), factory.newInstance(camelContext)); } catch (Exception e) { diff --git a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cloud/ConsulServiceRegistryAutoConfiguration.java b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cloud/ConsulServiceRegistryAutoConfiguration.java index abdd88dbe92..f0698ebc479 100644 --- a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cloud/ConsulServiceRegistryAutoConfiguration.java +++ b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cloud/ConsulServiceRegistryAutoConfiguration.java @@ -16,9 +16,11 @@ */ package org.apache.camel.component.consul.springboot.cloud; +import org.apache.camel.CamelContext; import org.apache.camel.component.consul.cloud.ConsulServiceRegistry; import org.apache.camel.spring.boot.CamelAutoConfiguration; -import org.apache.camel.support.IntrospectionSupport; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -33,15 +35,16 @@ import org.springframework.context.annotation.Scope; @EnableConfigurationProperties(ConsulServiceRegistryConfiguration.class) public class ConsulServiceRegistryAutoConfiguration { + @Autowired + private CamelContext camelContext; + @Bean(name = "consul-service-registry") @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) public ConsulServiceRegistry consulServiceRegistry(ConsulServiceRegistryConfiguration configuration) throws Exception { ConsulServiceRegistry service = new ConsulServiceRegistry(); - IntrospectionSupport.setProperties( - service, - IntrospectionSupport.getNonNullProperties(configuration) - ); + CamelPropertiesHelper.setCamelProperties(camelContext, service, + CamelPropertiesHelper.getNonNullProperties(camelContext, configuration), false); return service; } diff --git a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cloud/ConsulServiceRegistryConfiguration.java b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cloud/ConsulServiceRegistryConfiguration.java index 547a80a98b5..00adfe2face 100644 --- a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cloud/ConsulServiceRegistryConfiguration.java +++ b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cloud/ConsulServiceRegistryConfiguration.java @@ -29,6 +29,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "camel.cloud.consul") public class ConsulServiceRegistryConfiguration extends org.apache.camel.component.consul.cloud.ConsulServiceRegistryConfiguration { + /** * Sets if the consul service registry should be enabled or not, default is false. */ diff --git a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cluster/ConsulClusterServiceAutoConfiguration.java b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cluster/ConsulClusterServiceAutoConfiguration.java index 6df8c6ba9f5..02dd1f4a21c 100644 --- a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cluster/ConsulClusterServiceAutoConfiguration.java +++ b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cluster/ConsulClusterServiceAutoConfiguration.java @@ -16,11 +16,12 @@ */ package org.apache.camel.component.consul.springboot.cluster; +import org.apache.camel.CamelContext; import org.apache.camel.cluster.CamelClusterService; import org.apache.camel.component.consul.cluster.ConsulClusterService; import org.apache.camel.spring.boot.CamelAutoConfiguration; import org.apache.camel.spring.boot.cluster.ClusteredRouteControllerAutoConfiguration; -import org.apache.camel.support.IntrospectionSupport; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.boot.autoconfigure.AutoConfigureBefore; @@ -35,6 +36,9 @@ import org.springframework.context.annotation.Scope; @ConditionalOnProperty(prefix = "camel.cluster.consul", name = "enabled") @EnableConfigurationProperties(ConsulClusterServiceConfiguration.class) public class ConsulClusterServiceAutoConfiguration { + + @Autowired + private CamelContext camelContext; @Autowired private ConsulClusterServiceConfiguration configuration; @@ -43,10 +47,8 @@ public class ConsulClusterServiceAutoConfiguration { public CamelClusterService consulClusterService() throws Exception { ConsulClusterService service = new ConsulClusterService(); - IntrospectionSupport.setProperties( - service, - IntrospectionSupport.getNonNullProperties(configuration) - ); + CamelPropertiesHelper.setCamelProperties(camelContext, service, + CamelPropertiesHelper.getNonNullProperties(camelContext, configuration), false); return service; } diff --git a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cluster/ConsulClusterServiceConfiguration.java b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cluster/ConsulClusterServiceConfiguration.java index 78d57e80406..145e0b0107f 100644 --- a/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cluster/ConsulClusterServiceConfiguration.java +++ b/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/cluster/ConsulClusterServiceConfiguration.java @@ -30,6 +30,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "camel.cluster.consul") public class ConsulClusterServiceConfiguration extends ConsulClusterConfiguration { + /** * Sets if the consul cluster service should be enabled or not, default is false. */ diff --git a/components-starter/camel-core-starter/src/main/java/org/apache/camel/model/rest/springboot/RestConfigurationDefinitionAutoConfiguration.java b/components-starter/camel-core-starter/src/main/java/org/apache/camel/model/rest/springboot/RestConfigurationDefinitionAutoConfiguration.java index 0e287f0c13e..a54a0d05564 100644 --- a/components-starter/camel-core-starter/src/main/java/org/apache/camel/model/rest/springboot/RestConfigurationDefinitionAutoConfiguration.java +++ b/components-starter/camel-core-starter/src/main/java/org/apache/camel/model/rest/springboot/RestConfigurationDefinitionAutoConfiguration.java @@ -21,7 +21,6 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.spi.RestConfiguration; import org.apache.camel.spring.boot.util.CamelPropertiesHelper; -import org.apache.camel.support.IntrospectionSupport; import org.apache.camel.util.CollectionHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureAfter; @@ -56,7 +55,7 @@ public class RestConfigurationDefinitionAutoConfiguration { public RestConfiguration configureRestConfigurationDefinition() throws Exception { Map<String, Object> properties = new HashMap<>(); - IntrospectionSupport.getProperties(config, properties, null, false); + camelContext.getCamelContextExtension().getBeanIntrospection().getProperties(config, properties, null, false); // These options is configured specially further below, so remove them first properties.remove("enableCors"); properties.remove("apiProperty"); diff --git a/components-starter/camel-dns-starter/src/main/java/org/apache/camel/component/dns/springboot/cloud/DnsCloudAutoConfiguration.java b/components-starter/camel-dns-starter/src/main/java/org/apache/camel/component/dns/springboot/cloud/DnsCloudAutoConfiguration.java index 29557f3322b..18e25e57590 100644 --- a/components-starter/camel-dns-starter/src/main/java/org/apache/camel/component/dns/springboot/cloud/DnsCloudAutoConfiguration.java +++ b/components-starter/camel-dns-starter/src/main/java/org/apache/camel/component/dns/springboot/cloud/DnsCloudAutoConfiguration.java @@ -26,9 +26,10 @@ import org.apache.camel.cloud.ServiceDiscovery; import org.apache.camel.component.dns.cloud.DnsServiceDiscoveryFactory; import org.apache.camel.model.cloud.springboot.DnsServiceCallServiceDiscoveryConfigurationCommon; import org.apache.camel.model.cloud.springboot.DnsServiceCallServiceDiscoveryConfigurationProperties; +import org.apache.camel.spi.BeanIntrospection; import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; import org.apache.camel.spring.boot.util.GroupCondition; -import org.apache.camel.support.IntrospectionSupport; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -60,11 +61,8 @@ public class DnsCloudAutoConfiguration { public ServiceDiscovery configureServiceDiscoveryFactory() throws Exception { DnsServiceDiscoveryFactory factory = new DnsServiceDiscoveryFactory(); - IntrospectionSupport.setProperties( - camelContext, - camelContext.getTypeConverter(), - factory, - IntrospectionSupport.getNonNullProperties(configuration)); + CamelPropertiesHelper.setCamelProperties(camelContext, factory, + CamelPropertiesHelper.getNonNullProperties(camelContext, configuration), false); return factory.newInstance(camelContext); } @@ -81,9 +79,10 @@ public class DnsCloudAutoConfiguration { // The instance factory DnsServiceDiscoveryFactory factory = new DnsServiceDiscoveryFactory(); + BeanIntrospection bi = camelContext.getCamelContextExtension().getBeanIntrospection(); try { - IntrospectionSupport.getProperties(entry.getValue(), parameters, null, false); - IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), factory, parameters); + bi.getProperties(entry.getValue(), parameters, null, false); + CamelPropertiesHelper.setCamelProperties(camelContext, factory, parameters, false); beanFactory.registerSingleton(entry.getKey(), factory.newInstance(camelContext)); } catch (Exception e) { diff --git a/components-starter/camel-jgroups-raft-starter/src/main/java/org/apache/camel/component/jgroups/raft/springboot/cluster/springboot/JGroupsRaftClusterServiceAutoConfiguration.java b/components-starter/camel-jgroups-raft-starter/src/main/java/org/apache/camel/component/jgroups/raft/springboot/cluster/springboot/JGroupsRaftClusterServiceAutoConfiguration.java index a83b4973d4c..c31bd4452d3 100644 --- a/components-starter/camel-jgroups-raft-starter/src/main/java/org/apache/camel/component/jgroups/raft/springboot/cluster/springboot/JGroupsRaftClusterServiceAutoConfiguration.java +++ b/components-starter/camel-jgroups-raft-starter/src/main/java/org/apache/camel/component/jgroups/raft/springboot/cluster/springboot/JGroupsRaftClusterServiceAutoConfiguration.java @@ -16,11 +16,12 @@ */ package org.apache.camel.component.jgroups.raft.springboot.cluster.springboot; +import org.apache.camel.CamelContext; import org.apache.camel.cluster.CamelClusterService; import org.apache.camel.component.jgroups.raft.cluster.JGroupsRaftClusterService; import org.apache.camel.spring.boot.CamelAutoConfiguration; import org.apache.camel.spring.boot.cluster.ClusteredRouteControllerAutoConfiguration; -import org.apache.camel.support.IntrospectionSupport; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.boot.autoconfigure.AutoConfigureBefore; @@ -35,6 +36,10 @@ import org.springframework.context.annotation.Scope; @ConditionalOnProperty(prefix = "camel.cluster.jgroups-raft", name = "enabled") @EnableConfigurationProperties(JGroupsRaftClusterServiceConfiguration.class) public class JGroupsRaftClusterServiceAutoConfiguration { + + @Autowired + private CamelContext camelContext; + @Autowired private JGroupsRaftClusterServiceConfiguration configuration; @@ -43,10 +48,8 @@ public class JGroupsRaftClusterServiceAutoConfiguration { public CamelClusterService jgroupsRaftClusterService() throws Exception { JGroupsRaftClusterService service = new JGroupsRaftClusterService(); - IntrospectionSupport.setProperties( - service, - IntrospectionSupport.getNonNullProperties(configuration) - ); + CamelPropertiesHelper.setCamelProperties(camelContext, service, + CamelPropertiesHelper.getNonNullProperties(camelContext, configuration), false); return service; } diff --git a/components-starter/camel-jgroups-raft-starter/src/main/java/org/apache/camel/component/jgroups/raft/springboot/cluster/springboot/JGroupsRaftClusterServiceConfiguration.java b/components-starter/camel-jgroups-raft-starter/src/main/java/org/apache/camel/component/jgroups/raft/springboot/cluster/springboot/JGroupsRaftClusterServiceConfiguration.java index 6fd5078e413..232c6ef39ee 100644 --- a/components-starter/camel-jgroups-raft-starter/src/main/java/org/apache/camel/component/jgroups/raft/springboot/cluster/springboot/JGroupsRaftClusterServiceConfiguration.java +++ b/components-starter/camel-jgroups-raft-starter/src/main/java/org/apache/camel/component/jgroups/raft/springboot/cluster/springboot/JGroupsRaftClusterServiceConfiguration.java @@ -20,6 +20,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "camel.cluster.jgroups-raft") public class JGroupsRaftClusterServiceConfiguration { + /** * Sets if the jgroups raft cluster service should be enabled or not, default is false. */ diff --git a/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/cluster/springboot/JGroupsLockClusterServiceAutoConfiguration.java b/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/cluster/springboot/JGroupsLockClusterServiceAutoConfiguration.java index 8f6b5aaac7e..5f28227b922 100644 --- a/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/cluster/springboot/JGroupsLockClusterServiceAutoConfiguration.java +++ b/components-starter/camel-jgroups-starter/src/main/java/org/apache/camel/component/jgroups/springboot/cluster/springboot/JGroupsLockClusterServiceAutoConfiguration.java @@ -16,11 +16,12 @@ */ package org.apache.camel.component.jgroups.springboot.cluster.springboot; +import org.apache.camel.CamelContext; import org.apache.camel.cluster.CamelClusterService; import org.apache.camel.component.jgroups.cluster.JGroupsLockClusterService; import org.apache.camel.spring.boot.CamelAutoConfiguration; import org.apache.camel.spring.boot.cluster.ClusteredRouteControllerAutoConfiguration; -import org.apache.camel.support.IntrospectionSupport; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.boot.autoconfigure.AutoConfigureBefore; @@ -35,6 +36,10 @@ import org.springframework.context.annotation.Scope; @ConditionalOnProperty(prefix = "camel.cluster.jgroups", name = "enabled") @EnableConfigurationProperties(JGroupsLockClusterServiceConfiguration.class) public class JGroupsLockClusterServiceAutoConfiguration { + + @Autowired + private CamelContext camelContext; + @Autowired private JGroupsLockClusterServiceConfiguration configuration; @@ -43,10 +48,8 @@ public class JGroupsLockClusterServiceAutoConfiguration { public CamelClusterService zookeeperClusterService() throws Exception { JGroupsLockClusterService service = new JGroupsLockClusterService(); - IntrospectionSupport.setProperties( - service, - IntrospectionSupport.getNonNullProperties(configuration) - ); + CamelPropertiesHelper.setCamelProperties(camelContext, service, + CamelPropertiesHelper.getNonNullProperties(camelContext, configuration), false); return service; } diff --git a/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesServiceDiscoveryAutoConfiguration.java b/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesServiceDiscoveryAutoConfiguration.java index 704f63b75e7..4762c7ad73d 100644 --- a/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesServiceDiscoveryAutoConfiguration.java +++ b/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cloud/KubernetesServiceDiscoveryAutoConfiguration.java @@ -26,9 +26,10 @@ import org.apache.camel.cloud.ServiceDiscovery; import org.apache.camel.component.kubernetes.cloud.KubernetesServiceDiscoveryFactory; import org.apache.camel.model.cloud.springboot.KubernetesServiceCallServiceDiscoveryConfigurationCommon; import org.apache.camel.model.cloud.springboot.KubernetesServiceCallServiceDiscoveryConfigurationProperties; +import org.apache.camel.spi.BeanIntrospection; import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; import org.apache.camel.spring.boot.util.GroupCondition; -import org.apache.camel.support.IntrospectionSupport; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -58,11 +59,8 @@ public class KubernetesServiceDiscoveryAutoConfiguration { public ServiceDiscovery configureServiceDiscoveryFactory() throws Exception { KubernetesServiceDiscoveryFactory factory = new KubernetesServiceDiscoveryFactory(); - IntrospectionSupport.setProperties( - camelContext, - camelContext.getTypeConverter(), - factory, - IntrospectionSupport.getNonNullProperties(configuration)); + CamelPropertiesHelper.setCamelProperties(camelContext, factory, + CamelPropertiesHelper.getNonNullProperties(camelContext, configuration), false); return factory.newInstance(camelContext); } @@ -79,9 +77,10 @@ public class KubernetesServiceDiscoveryAutoConfiguration { // The instance factory KubernetesServiceDiscoveryFactory factory = new KubernetesServiceDiscoveryFactory(); + BeanIntrospection bi = camelContext.getCamelContextExtension().getBeanIntrospection(); try { - IntrospectionSupport.getProperties(entry.getValue(), parameters, null, false); - IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), factory, parameters); + bi.getProperties(entry.getValue(), parameters, null, false); + CamelPropertiesHelper.setCamelProperties(camelContext, factory, parameters, true); beanFactory.registerSingleton(entry.getKey(), factory.newInstance(camelContext)); } catch (Exception e) { diff --git a/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cluster/KubernetesClusterServiceAutoConfiguration.java b/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cluster/KubernetesClusterServiceAutoConfiguration.java index 6eb6a8aca44..f392fb2c8ed 100644 --- a/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cluster/KubernetesClusterServiceAutoConfiguration.java +++ b/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cluster/KubernetesClusterServiceAutoConfiguration.java @@ -16,11 +16,12 @@ */ package org.apache.camel.component.kubernetes.springboot.cluster; +import org.apache.camel.CamelContext; import org.apache.camel.cluster.CamelClusterService; import org.apache.camel.component.kubernetes.cluster.KubernetesClusterService; import org.apache.camel.spring.boot.CamelAutoConfiguration; import org.apache.camel.spring.boot.cluster.ClusteredRouteControllerAutoConfiguration; -import org.apache.camel.support.IntrospectionSupport; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.boot.autoconfigure.AutoConfigureBefore; @@ -35,6 +36,10 @@ import org.springframework.context.annotation.Scope; @ConditionalOnProperty(prefix = "camel.cluster.kubernetes", name = "enabled") @EnableConfigurationProperties(KubernetesClusterServiceConfiguration.class) public class KubernetesClusterServiceAutoConfiguration { + + @Autowired + private CamelContext camelContext; + @Autowired private KubernetesClusterServiceConfiguration configuration; @@ -43,10 +48,8 @@ public class KubernetesClusterServiceAutoConfiguration { public CamelClusterService kubernetesClusterService() throws Exception { KubernetesClusterService service = new KubernetesClusterService(); - IntrospectionSupport.setProperties( - service, - IntrospectionSupport.getNonNullProperties(configuration) - ); + CamelPropertiesHelper.setCamelProperties(camelContext, service, + CamelPropertiesHelper.getNonNullProperties(camelContext, configuration), false); return service; } diff --git a/components-starter/camel-lra-starter/src/main/java/org/apache/camel/service/lra/springboot/LraServiceAutoConfiguration.java b/components-starter/camel-lra-starter/src/main/java/org/apache/camel/service/lra/springboot/LraServiceAutoConfiguration.java index abca6418e1d..65a9b0dddab 100644 --- a/components-starter/camel-lra-starter/src/main/java/org/apache/camel/service/lra/springboot/LraServiceAutoConfiguration.java +++ b/components-starter/camel-lra-starter/src/main/java/org/apache/camel/service/lra/springboot/LraServiceAutoConfiguration.java @@ -16,17 +16,12 @@ */ package org.apache.camel.service.lra.springboot; -import java.util.HashMap; -import java.util.Map; - import org.apache.camel.CamelContext; import org.apache.camel.saga.CamelSagaService; import org.apache.camel.service.lra.LRASagaService; import org.apache.camel.spring.boot.CamelAutoConfiguration; -import org.apache.camel.spring.boot.util.CamelPropertiesHelper; import org.apache.camel.spring.boot.util.ConditionalOnCamelContextAndAutoConfigurationBeans; import org.apache.camel.spring.boot.util.GroupCondition; -import org.apache.camel.support.IntrospectionSupport; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; diff --git a/components-starter/camel-resilience4j-starter/src/main/java/org/apache/camel/component/resilience/springboot/ResilienceAutoConfiguration.java b/components-starter/camel-resilience4j-starter/src/main/java/org/apache/camel/component/resilience/springboot/ResilienceAutoConfiguration.java index 96fcf21d0d4..1d317c0556a 100644 --- a/components-starter/camel-resilience4j-starter/src/main/java/org/apache/camel/component/resilience/springboot/ResilienceAutoConfiguration.java +++ b/components-starter/camel-resilience4j-starter/src/main/java/org/apache/camel/component/resilience/springboot/ResilienceAutoConfiguration.java @@ -25,8 +25,9 @@ import org.apache.camel.component.resilience4j.ResilienceConstants; import org.apache.camel.model.Resilience4jConfigurationDefinition; import org.apache.camel.model.springboot.Resilience4jConfigurationDefinitionCommon; import org.apache.camel.model.springboot.Resilience4jConfigurationDefinitionProperties; +import org.apache.camel.spi.BeanIntrospection; import org.apache.camel.spring.boot.CamelAutoConfiguration; -import org.apache.camel.support.IntrospectionSupport; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -61,9 +62,10 @@ public class ResilienceAutoConfiguration { public Resilience4jConfigurationDefinition defaultResilienceConfigurationDefinition() throws Exception { Map<String, Object> properties = new HashMap<>(); - IntrospectionSupport.getProperties(config, properties, null, false); + BeanIntrospection bi = camelContext.getCamelContextExtension().getBeanIntrospection(); + bi.getProperties(config, properties, null, false); Resilience4jConfigurationDefinition definition = new Resilience4jConfigurationDefinition(); - IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), definition, properties); + CamelPropertiesHelper.setCamelProperties(camelContext, definition, properties, false); return definition; } @@ -82,11 +84,12 @@ public class ResilienceAutoConfiguration { properties.clear(); // extract properties - IntrospectionSupport.getProperties(entry.getValue(), properties, null, false); + BeanIntrospection bi = camelContext.getCamelContextExtension().getBeanIntrospection(); + bi.getProperties(entry.getValue(), properties, null, false); try { Resilience4jConfigurationDefinition definition = new Resilience4jConfigurationDefinition(); - IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), definition, properties); + CamelPropertiesHelper.setCamelProperties(camelContext, definition, properties, false); // Registry the definition beanFactory.registerSingleton(entry.getKey(), definition); diff --git a/components-starter/camel-stax-starter/src/main/docs/stax.json b/components-starter/camel-stax-starter/src/main/docs/stax.json index 4b131b06158..e0a86f4c9a2 100644 --- a/components-starter/camel-stax-starter/src/main/docs/stax.json +++ b/components-starter/camel-stax-starter/src/main/docs/stax.json @@ -64,7 +64,8 @@ "name": "camel.language.xtokenize.mode", "type": "java.lang.String", "description": "The extraction mode. The available extraction modes are: i - injecting the contextual namespace bindings into the extracted token (default) w - wrapping the extracted token in its ancestor context u - unwrapping the extracted token to its child content t - extracting the text content of the specified element", - "sourceType": "org.apache.camel.language.xtokenizer.springboot.XMLTokenizeLanguageConfiguration" + "sourceType": "org.apache.camel.language.xtokenizer.springboot.XMLTokenizeLanguageConfiguration", + "defaultValue": "i" }, { "name": "camel.language.xtokenize.namespace", diff --git a/components-starter/camel-stax-starter/src/main/java/org/apache/camel/language/xtokenizer/springboot/XMLTokenizeLanguageConfiguration.java b/components-starter/camel-stax-starter/src/main/java/org/apache/camel/language/xtokenizer/springboot/XMLTokenizeLanguageConfiguration.java index 3ef52782010..b4d4fcd52fc 100644 --- a/components-starter/camel-stax-starter/src/main/java/org/apache/camel/language/xtokenizer/springboot/XMLTokenizeLanguageConfiguration.java +++ b/components-starter/camel-stax-starter/src/main/java/org/apache/camel/language/xtokenizer/springboot/XMLTokenizeLanguageConfiguration.java @@ -43,7 +43,7 @@ public class XMLTokenizeLanguageConfiguration * extracted token to its child content t - extracting the text content of * the specified element */ - private String mode; + private String mode = "i"; /** * Injects the XML Namespaces of prefix - uri mappings */ diff --git a/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cloud/ZooKeeperServiceRegistryAutoConfiguration.java b/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cloud/ZooKeeperServiceRegistryAutoConfiguration.java index d96b4fe45c7..1d36ebfec64 100644 --- a/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cloud/ZooKeeperServiceRegistryAutoConfiguration.java +++ b/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cloud/ZooKeeperServiceRegistryAutoConfiguration.java @@ -16,9 +16,11 @@ */ package org.apache.camel.component.zookeeper.springboot.cloud; +import org.apache.camel.CamelContext; import org.apache.camel.component.zookeeper.cloud.ZooKeeperServiceRegistry; import org.apache.camel.spring.boot.CamelAutoConfiguration; -import org.apache.camel.support.IntrospectionSupport; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -33,15 +35,16 @@ import org.springframework.context.annotation.Scope; @EnableConfigurationProperties(ZooKeeperServiceRegistryConfiguration.class) public class ZooKeeperServiceRegistryAutoConfiguration { + @Autowired + private CamelContext camelContext; + @Bean(name = "zookeeper-service-registry") @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) public ZooKeeperServiceRegistry zookeeperServiceRegistry(ZooKeeperServiceRegistryConfiguration configuration) throws Exception { ZooKeeperServiceRegistry service = new ZooKeeperServiceRegistry(); - IntrospectionSupport.setProperties( - service, - IntrospectionSupport.getNonNullProperties(configuration) - ); + CamelPropertiesHelper.setCamelProperties(camelContext, service, + CamelPropertiesHelper.getNonNullProperties(camelContext, configuration), false); return service; } diff --git a/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cloud/ZooKeeperServiceRegistryConfiguration.java b/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cloud/ZooKeeperServiceRegistryConfiguration.java index 2f315bdc5b9..3c9d3a69b14 100644 --- a/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cloud/ZooKeeperServiceRegistryConfiguration.java +++ b/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cloud/ZooKeeperServiceRegistryConfiguration.java @@ -27,6 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "camel.cloud.zookeeper") public class ZooKeeperServiceRegistryConfiguration extends org.apache.camel.component.zookeeper.cloud.ZooKeeperServiceRegistryConfiguration { + /** * Sets if the zookeeper service registry should be enabled or not, default is false. */ diff --git a/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cluster/ZooKeeperClusterServiceAutoConfiguration.java b/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cluster/ZooKeeperClusterServiceAutoConfiguration.java index adc600aa6e8..c5bd1f7f7de 100644 --- a/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cluster/ZooKeeperClusterServiceAutoConfiguration.java +++ b/components-starter/camel-zookeeper-starter/src/main/java/org/apache/camel/component/zookeeper/springboot/cluster/ZooKeeperClusterServiceAutoConfiguration.java @@ -16,11 +16,12 @@ */ package org.apache.camel.component.zookeeper.springboot.cluster; +import org.apache.camel.CamelContext; import org.apache.camel.cluster.CamelClusterService; import org.apache.camel.component.zookeeper.cluster.ZooKeeperClusterService; import org.apache.camel.spring.boot.CamelAutoConfiguration; import org.apache.camel.spring.boot.cluster.ClusteredRouteControllerAutoConfiguration; -import org.apache.camel.support.IntrospectionSupport; +import org.apache.camel.spring.boot.util.CamelPropertiesHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.boot.autoconfigure.AutoConfigureBefore; @@ -35,6 +36,10 @@ import org.springframework.context.annotation.Scope; @ConditionalOnProperty(prefix = "camel.cluster.zookeeper", name = "enabled") @EnableConfigurationProperties(ZooKeeperClusterServiceConfiguration.class) public class ZooKeeperClusterServiceAutoConfiguration { + + @Autowired + private CamelContext camelContext; + @Autowired private ZooKeeperClusterServiceConfiguration configuration; @@ -43,10 +48,8 @@ public class ZooKeeperClusterServiceAutoConfiguration { public CamelClusterService zookeeperClusterService() throws Exception { ZooKeeperClusterService service = new ZooKeeperClusterService(); - IntrospectionSupport.setProperties( - service, - IntrospectionSupport.getNonNullProperties(configuration) - ); + CamelPropertiesHelper.setCamelProperties(camelContext, service, + CamelPropertiesHelper.getNonNullProperties(camelContext, configuration), false); return service; } diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/CamelPropertiesHelper.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/CamelPropertiesHelper.java index cc4c70bbfe7..6d45e736871 100644 --- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/CamelPropertiesHelper.java +++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/CamelPropertiesHelper.java @@ -16,14 +16,15 @@ */ package org.apache.camel.spring.boot.util; +import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.Component; import org.apache.camel.PropertyBindingException; +import org.apache.camel.spi.BeanIntrospection; import org.apache.camel.spi.PropertyConfigurer; -import org.apache.camel.support.IntrospectionSupport; import org.apache.camel.support.PropertyBindingSupport; import org.apache.camel.support.service.ServiceHelper; import org.apache.camel.util.ObjectHelper; @@ -36,7 +37,7 @@ public final class CamelPropertiesHelper { private CamelPropertiesHelper() { } - @SuppressWarnings({"unchecked", "deprecation"}) + @SuppressWarnings({"unchecked"}) public static void copyProperties(CamelContext camelContext, Object source, Object target) { ObjectHelper.notNull(camelContext, "camel context"); ObjectHelper.notNull(source, "source"); @@ -45,7 +46,7 @@ public final class CamelPropertiesHelper { CamelPropertiesHelper.setCamelProperties( camelContext, target, - source instanceof Map ? (Map)source : IntrospectionSupport.getNonNullProperties(source), + source instanceof Map ? (Map)source : getNonNullProperties(camelContext, source), false); } @@ -130,4 +131,20 @@ public final class CamelPropertiesHelper { return rc; } + /** + * Gets all the non-null properties from the given object, + * + * @param camelContext the camel context + * @param target the object + * @return the properties (non-null only) + */ + public static Map<String, Object> getNonNullProperties(CamelContext camelContext, Object target) { + Map<String, Object> properties = new HashMap<>(); + + BeanIntrospection bi = camelContext.getCamelContextExtension().getBeanIntrospection(); + bi.getProperties(target, properties, null, false); + + return properties; + } + } diff --git a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java index c16606131a3..90514eac616 100644 --- a/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java +++ b/tooling/camel-spring-boot-generator-maven-plugin/src/main/java/org/apache/camel/springboot/maven/SpringBootAutoConfigurationMojo.java @@ -421,7 +421,6 @@ public class SpringBootAutoConfigurationMojo extends AbstractSpringBootGenerator javaClass.addImport("java.util.Map"); javaClass.addImport("java.util.HashMap"); javaClass.addImport("org.apache.camel.util.CollectionHelper"); - javaClass.addImport("org.apache.camel.support.IntrospectionSupport"); javaClass.addImport("org.apache.camel.spring.boot.util.CamelPropertiesHelper"); javaClass.addImport("org.apache.camel.CamelContext"); javaClass.addImport("org.apache.camel.spi.RestConfiguration"); @@ -441,7 +440,7 @@ public class SpringBootAutoConfigurationMojo extends AbstractSpringBootGenerator method.addAnnotation(Bean.class).setLiteralValue("name", "\"rest-configuration\""); method.addAnnotation(ConditionalOnClass.class).setLiteralValue("value", "CamelContext.class"); method.addAnnotation(ConditionalOnMissingBean.class); - method.setBody("" + "Map<String, Object> properties = new HashMap<>();\n" + "IntrospectionSupport.getProperties(config, properties, null, false);\n" + method.setBody("" + "Map<String, Object> properties = new HashMap<>();\n" + "camelContext.getCamelContextExtension().getBeanIntrospection().getProperties(config, properties, null, false);\n" + "// These options is configured specially further below, so remove them first\n" + "properties.remove(\"enableCors\");\n" + "properties.remove(\"apiProperty\");\n" + "properties.remove(\"componentProperty\");\n" + "properties.remove(\"consumerProperty\");\n" + "properties.remove(\"dataFormatProperty\");\n" + "properties.remove(\"endpointProperty\");\n" + "properties.remove(\"corsHeaders\");\n" + "\n"