This is an automated email from the ASF dual-hosted git repository.

fmariani 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 d07cc28f808 Refactor cluster service autoconfiguration
d07cc28f808 is described below

commit d07cc28f808c27b76bde866b6ad1f058563ffe6a
Author: Croway <federico.mariani.1...@gmail.com>
AuthorDate: Mon Sep 4 16:44:04 2023 +0200

    Refactor cluster service autoconfiguration
---
 .../ConsulClusterServiceAutoConfiguration.java     |  41 +++++-
 .../src/main/docs/infinispan.json                  |  90 ++++++++++++
 ...ispanRemoteClusterServiceAutoConfiguration.java |  42 ++++++
 ...nfinispanRemoteClusterServiceConfiguration.java | 153 +++++++++++++++++++++
 ...rk.boot.autoconfigure.AutoConfiguration.imports |   1 +
 ...JGroupsRaftClusterServiceAutoConfiguration.java |  17 ++-
 ...JGroupsLockClusterServiceAutoConfiguration.java |  15 +-
 .../KubernetesClusterServiceAutoConfiguration.java |  35 ++++-
 .../ZooKeeperClusterServiceAutoConfiguration.java  |  46 ++++++-
 9 files changed, 406 insertions(+), 34 deletions(-)

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 02dd1f4a21c..616abf47407 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,12 +16,10 @@
  */
 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.spring.boot.util.CamelPropertiesHelper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
 import org.springframework.boot.autoconfigure.AutoConfigureBefore;
@@ -31,14 +29,14 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Scope;
 
+import java.util.Optional;
+
 @Configuration(proxyBeanMethods = false)
 @AutoConfigureBefore({ ClusteredRouteControllerAutoConfiguration.class, 
CamelAutoConfiguration.class })
 @ConditionalOnProperty(prefix = "camel.cluster.consul", name = "enabled")
 @EnableConfigurationProperties(ConsulClusterServiceConfiguration.class)
 public class ConsulClusterServiceAutoConfiguration {
 
-    @Autowired
-    private CamelContext camelContext;
     @Autowired
     private ConsulClusterServiceConfiguration configuration;
 
@@ -47,8 +45,39 @@ public class ConsulClusterServiceAutoConfiguration {
     public CamelClusterService consulClusterService() throws Exception {
         ConsulClusterService service = new ConsulClusterService();
 
-        CamelPropertiesHelper.setCamelProperties(camelContext, service,
-                CamelPropertiesHelper.getNonNullProperties(camelContext, 
configuration), false);
+        Optional.ofNullable(configuration.getId())
+                .ifPresent(service::setId);
+        Optional.ofNullable(configuration.getOrder())
+                .ifPresent(service::setOrder);
+        Optional.ofNullable(configuration.getAttributes())
+                .ifPresent(service::setAttributes);
+        Optional.ofNullable(configuration.getAclToken())
+                .ifPresent(service::setAclToken);
+        Optional.ofNullable(configuration.getDatacenter())
+                .ifPresent(service::setDatacenter);
+        Optional.ofNullable(configuration.getBlockSeconds())
+                .ifPresent(service::setBlockSeconds);
+        Optional.ofNullable(configuration.getConnectTimeout())
+                .ifPresent(service::setConnectTimeout);
+        Optional.ofNullable(configuration.getUrl())
+                .ifPresent(service::setUrl);
+        Optional.ofNullable(configuration.getSessionLockDelay())
+                .ifPresent(service::setLockDelay);
+        Optional.ofNullable(configuration.getPassword())
+                .ifPresent(service::setPassword);
+        Optional.ofNullable(configuration.getReadTimeout())
+                .ifPresent(service::setReadTimeout);
+        Optional.ofNullable(configuration.getRootPath())
+                .ifPresent(service::setRootPath);
+        Optional.ofNullable(configuration.getSslContextParameters())
+                .ifPresent(service::setSslContextParameters);
+        Optional.ofNullable(configuration.getSessionTtl())
+                .ifPresent(service::setTtl);
+        Optional.ofNullable(configuration.getUserName())
+                .ifPresent(service::setUserName);
+        Optional.ofNullable(configuration.getWriteTimeout())
+                .ifPresent(service::setWriteTimeout);
+        service.setConfiguration(configuration);
 
         return service;
     }
diff --git 
a/components-starter/camel-infinispan-starter/src/main/docs/infinispan.json 
b/components-starter/camel-infinispan-starter/src/main/docs/infinispan.json
index 13ff12ae031..0f335ce412a 100644
--- a/components-starter/camel-infinispan-starter/src/main/docs/infinispan.json
+++ b/components-starter/camel-infinispan-starter/src/main/docs/infinispan.json
@@ -1,5 +1,10 @@
 {
   "groups": [
+    {
+      "name": "camel.cluster.infinispan.remote",
+      "type": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
     {
       "name": "camel.component.infinispan",
       "type": 
"org.apache.camel.component.infinispan.remote.springboot.InfinispanRemoteComponentConfiguration",
@@ -37,6 +42,91 @@
     }
   ],
   "properties": [
+    {
+      "name": "camel.cluster.infinispan.remote.attributes",
+      "type": "java.util.Map<java.lang.String,java.lang.Object>",
+      "description": "Custom service attributes.",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
+    {
+      "name": "camel.cluster.infinispan.remote.cache-container",
+      "type": "org.infinispan.client.hotrod.RemoteCacheManager",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
+    {
+      "name": "camel.cluster.infinispan.remote.cache-container-configuration",
+      "type": "org.infinispan.client.hotrod.configuration.Configuration",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
+    {
+      "name": "camel.cluster.infinispan.remote.configuration-properties",
+      "type": "java.util.Map<java.lang.String,java.lang.String>",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
+    {
+      "name": "camel.cluster.infinispan.remote.enabled",
+      "type": "java.lang.Boolean",
+      "description": "Sets if the zookeeper cluster service should be enabled 
or not, default is false.",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration",
+      "defaultValue": false
+    },
+    {
+      "name": "camel.cluster.infinispan.remote.hosts",
+      "type": "java.lang.String",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
+    {
+      "name": "camel.cluster.infinispan.remote.id",
+      "type": "java.lang.String",
+      "description": "Cluster Service ID",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
+    {
+      "name": "camel.cluster.infinispan.remote.lifespan",
+      "type": "java.lang.Long",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
+    {
+      "name": "camel.cluster.infinispan.remote.lifespan-time-unit",
+      "type": "java.util.concurrent.TimeUnit",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
+    {
+      "name": "camel.cluster.infinispan.remote.order",
+      "type": "java.lang.Integer",
+      "description": "Service lookup order\/priority.",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
+    {
+      "name": "camel.cluster.infinispan.remote.password",
+      "type": "java.lang.String",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
+    {
+      "name": "camel.cluster.infinispan.remote.sasl-mechanism",
+      "type": "java.lang.String",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
+    {
+      "name": "camel.cluster.infinispan.remote.secure",
+      "type": "java.lang.Boolean",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
+    {
+      "name": "camel.cluster.infinispan.remote.security-realm",
+      "type": "java.lang.String",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
+    {
+      "name": "camel.cluster.infinispan.remote.security-server-name",
+      "type": "java.lang.String",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
+    {
+      "name": "camel.cluster.infinispan.remote.username",
+      "type": "java.lang.String",
+      "sourceType": 
"org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceConfiguration"
+    },
     {
       "name": "camel.component.infinispan.autowired-enabled",
       "type": "java.lang.Boolean",
diff --git 
a/components-starter/camel-infinispan-starter/src/main/java/org/apache/camel/component/infinispan/remote/springboot/cluster/InfinispanRemoteClusterServiceAutoConfiguration.java
 
b/components-starter/camel-infinispan-starter/src/main/java/org/apache/camel/component/infinispan/remote/springboot/cluster/InfinispanRemoteClusterServiceAutoConfiguration.java
new file mode 100644
index 00000000000..9568e78c98f
--- /dev/null
+++ 
b/components-starter/camel-infinispan-starter/src/main/java/org/apache/camel/component/infinispan/remote/springboot/cluster/InfinispanRemoteClusterServiceAutoConfiguration.java
@@ -0,0 +1,42 @@
+package org.apache.camel.component.infinispan.remote.springboot.cluster;
+
+import org.apache.camel.cluster.CamelClusterService;
+import 
org.apache.camel.component.infinispan.remote.cluster.InfinispanRemoteClusterService;
+import org.apache.camel.spring.boot.CamelAutoConfiguration;
+import 
org.apache.camel.spring.boot.cluster.ClusteredRouteControllerAutoConfiguration;
+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;
+import 
org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Scope;
+
+import java.util.Optional;
+
+@Configuration
+@AutoConfigureBefore({ ClusteredRouteControllerAutoConfiguration.class, 
CamelAutoConfiguration.class })
+@ConditionalOnProperty(prefix = "camel.cluster.infinispan.remote", name = 
"enabled")
+@EnableConfigurationProperties(InfinispanRemoteClusterServiceConfiguration.class)
+public class InfinispanRemoteClusterServiceAutoConfiguration {
+
+    @Autowired
+    private InfinispanRemoteClusterServiceConfiguration configuration;
+
+    @Bean(name = "infinispan-remote-cluster-service")
+    @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
+    public CamelClusterService infinispanRemoteClusterService() {
+        InfinispanRemoteClusterService service = new 
InfinispanRemoteClusterService();
+
+        Optional.ofNullable(configuration.getId())
+                .ifPresent(service::setId);
+        Optional.ofNullable(configuration.getOrder())
+                .ifPresent(service::setOrder);
+        Optional.ofNullable(configuration.getAttributes())
+                .ifPresent(service::setAttributes);
+        service.setConfiguration(configuration);
+
+        return service;
+    }
+}
diff --git 
a/components-starter/camel-infinispan-starter/src/main/java/org/apache/camel/component/infinispan/remote/springboot/cluster/InfinispanRemoteClusterServiceConfiguration.java
 
b/components-starter/camel-infinispan-starter/src/main/java/org/apache/camel/component/infinispan/remote/springboot/cluster/InfinispanRemoteClusterServiceConfiguration.java
new file mode 100644
index 00000000000..4224e3a194e
--- /dev/null
+++ 
b/components-starter/camel-infinispan-starter/src/main/java/org/apache/camel/component/infinispan/remote/springboot/cluster/InfinispanRemoteClusterServiceConfiguration.java
@@ -0,0 +1,153 @@
+package org.apache.camel.component.infinispan.remote.springboot.cluster;
+
+import 
org.apache.camel.component.infinispan.remote.cluster.InfinispanRemoteClusterConfiguration;
+import org.infinispan.client.hotrod.RemoteCacheManager;
+import  org.infinispan.client.hotrod.configuration.Configuration;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+import java.util.Map;
+
+@ConfigurationProperties(prefix = "camel.cluster.infinispan.remote")
+public class InfinispanRemoteClusterServiceConfiguration extends 
InfinispanRemoteClusterConfiguration {
+    /**
+     * Sets if the zookeeper cluster service should be enabled or not, default 
is false.
+     */
+    private boolean enabled = false;
+
+    /**
+     * Cluster Service ID
+     */
+    private String id;
+
+    /**
+     * Custom service attributes.
+     */
+    private Map<String, Object> attributes;
+
+    /**
+     * Service lookup order/priority.
+     */
+    private Integer order;
+
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Map<String, Object> getAttributes() {
+        return attributes;
+    }
+
+    public void setAttributes(Map<String, Object> attributes) {
+        this.attributes = attributes;
+    }
+
+    public Integer getOrder() {
+        return order;
+    }
+
+    public void setOrder(Integer order) {
+        this.order = order;
+    }
+
+    //
+    // Fields copied from InifnispanRemoteConfiguration to add
+    // javadoc which is used by spring-boot-configuration-processor
+    // to generate descritpions for inherited properties
+    // ------------------------------------------
+
+    public String getHosts() {
+        return getConfiguration().getHosts();
+    }
+
+    public void setHosts(String hosts) {
+        getConfiguration().setHosts(hosts);
+    }
+
+    public boolean isSecure() {
+        return getConfiguration().isSecure();
+    }
+
+    public void setSecure(boolean secure) {
+        getConfiguration().setSecure(secure);
+    }
+
+    public String getUsername() {
+        return getConfiguration().getUsername();
+    }
+
+    public void setUsername(String username) {
+        getConfiguration().setUsername(username);
+    }
+
+    public String getPassword() {
+        return getConfiguration().getPassword();
+    }
+
+    public void setPassword(String password) {
+        getConfiguration().setPassword(password);
+    }
+
+    public String getSaslMechanism() {
+        return getConfiguration().getSaslMechanism();
+    }
+
+    public void setSaslMechanism(String saslMechanism) {
+        getConfiguration().setSaslMechanism(saslMechanism);
+    }
+
+    public String getSecurityRealm() {
+        return getConfiguration().getSecurityRealm();
+    }
+
+    public void setSecurityRealm(String securityRealm) {
+        getConfiguration().setSecurityRealm(securityRealm);
+    }
+
+    public String getSecurityServerName() {
+        return getConfiguration().getSecurityServerName();
+    }
+
+    public void setSecurityServerName(String securityServerName) {
+        getConfiguration().setSecurityServerName(securityServerName);
+    }
+
+    public Map<String, String> getConfigurationProperties() {
+        return getConfiguration().getConfigurationProperties();
+    }
+
+    public void setConfigurationProperties(Map<String, String> 
configurationProperties) {
+        getConfiguration().setConfigurationProperties(configurationProperties);
+    }
+
+    public void addConfigurationProperty(String key, String value) {
+        getConfiguration().addConfigurationProperty(key, value);
+    }
+
+    public RemoteCacheManager getCacheContainer() {
+        return getConfiguration().getCacheContainer();
+    }
+
+    public void setCacheContainer(RemoteCacheManager cacheContainer) {
+        getConfiguration().setCacheContainer(cacheContainer);
+    }
+
+    public Configuration getCacheContainerConfiguration() {
+        return getConfiguration().getCacheContainerConfiguration();
+    }
+
+    public void setCacheContainerConfiguration(Configuration 
cacheContainerConfiguration) {
+        
getConfiguration().setCacheContainerConfiguration(cacheContainerConfiguration);
+    }
+}
diff --git 
a/components-starter/camel-infinispan-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
 
b/components-starter/camel-infinispan-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
index 9387ea57dd9..470e9c3536c 100644
--- 
a/components-starter/camel-infinispan-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
+++ 
b/components-starter/camel-infinispan-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -17,3 +17,4 @@
 
 
org.apache.camel.component.infinispan.remote.springboot.InfinispanRemoteComponentConverter
 
org.apache.camel.component.infinispan.remote.springboot.InfinispanRemoteComponentAutoConfiguration
+org.apache.camel.component.infinispan.remote.springboot.cluster.InfinispanRemoteClusterServiceAutoConfiguration
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 c31bd4452d3..5c9ffed3761 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,12 +16,10 @@
  */
 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.spring.boot.util.CamelPropertiesHelper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
 import org.springframework.boot.autoconfigure.AutoConfigureBefore;
@@ -31,15 +29,14 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Scope;
 
+import java.util.Optional;
+
 @Configuration(proxyBeanMethods = false)
 @AutoConfigureBefore({ ClusteredRouteControllerAutoConfiguration.class, 
CamelAutoConfiguration.class })
 @ConditionalOnProperty(prefix = "camel.cluster.jgroups-raft", name = "enabled")
 @EnableConfigurationProperties(JGroupsRaftClusterServiceConfiguration.class)
 public class JGroupsRaftClusterServiceAutoConfiguration {
 
-    @Autowired
-    private CamelContext camelContext;
-
     @Autowired
     private JGroupsRaftClusterServiceConfiguration configuration;
 
@@ -48,8 +45,14 @@ public class JGroupsRaftClusterServiceAutoConfiguration {
     public CamelClusterService jgroupsRaftClusterService() throws Exception {
         JGroupsRaftClusterService service = new JGroupsRaftClusterService();
 
-        CamelPropertiesHelper.setCamelProperties(camelContext, service,
-                CamelPropertiesHelper.getNonNullProperties(camelContext, 
configuration), false);
+        Optional.ofNullable(configuration.getId())
+                .ifPresent(service::setId);
+        Optional.ofNullable(configuration.getRaftId())
+                .ifPresent(service::setRaftId);
+        Optional.ofNullable(configuration.getJgroupsRaftClusterName())
+                .ifPresent(service::setJgroupsClusterName);
+        Optional.ofNullable(configuration.getJgroupsRaftConfig())
+                .ifPresent(service::setJgroupsConfig);
 
         return service;
     }
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 5f28227b922..bc968c41a67 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,12 +16,10 @@
  */
 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.spring.boot.util.CamelPropertiesHelper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
 import org.springframework.boot.autoconfigure.AutoConfigureBefore;
@@ -31,15 +29,14 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Scope;
 
+import java.util.Optional;
+
 @Configuration
 @AutoConfigureBefore({ ClusteredRouteControllerAutoConfiguration.class, 
CamelAutoConfiguration.class })
 @ConditionalOnProperty(prefix = "camel.cluster.jgroups", name = "enabled")
 @EnableConfigurationProperties(JGroupsLockClusterServiceConfiguration.class)
 public class JGroupsLockClusterServiceAutoConfiguration {
 
-    @Autowired
-    private CamelContext camelContext;
-
     @Autowired
     private JGroupsLockClusterServiceConfiguration configuration;
 
@@ -48,8 +45,12 @@ public class JGroupsLockClusterServiceAutoConfiguration {
     public CamelClusterService zookeeperClusterService() throws Exception {
         JGroupsLockClusterService service = new JGroupsLockClusterService();
 
-        CamelPropertiesHelper.setCamelProperties(camelContext, service,
-                CamelPropertiesHelper.getNonNullProperties(camelContext, 
configuration), false);
+        Optional.ofNullable(configuration.getId())
+                .ifPresent(service::setId);
+        Optional.ofNullable(configuration.getJgroupsClusterName())
+                .ifPresent(service::setJgroupsClusterName);
+        Optional.ofNullable(configuration.getJgroupsConfig())
+                .ifPresent(service::setJgroupsConfig);
 
         return service;
     }
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 f392fb2c8ed..fde4f10697f 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,12 +16,10 @@
  */
 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.spring.boot.util.CamelPropertiesHelper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
 import org.springframework.boot.autoconfigure.AutoConfigureBefore;
@@ -31,15 +29,14 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Scope;
 
+import java.util.Optional;
+
 @Configuration(proxyBeanMethods = false)
 @AutoConfigureBefore({ ClusteredRouteControllerAutoConfiguration.class, 
CamelAutoConfiguration.class })
 @ConditionalOnProperty(prefix = "camel.cluster.kubernetes", name = "enabled")
 @EnableConfigurationProperties(KubernetesClusterServiceConfiguration.class)
 public class KubernetesClusterServiceAutoConfiguration {
 
-    @Autowired
-    private CamelContext camelContext;
-
     @Autowired
     private KubernetesClusterServiceConfiguration configuration;
 
@@ -48,8 +45,32 @@ public class KubernetesClusterServiceAutoConfiguration {
     public CamelClusterService kubernetesClusterService() throws Exception {
         KubernetesClusterService service = new KubernetesClusterService();
 
-        CamelPropertiesHelper.setCamelProperties(camelContext, service,
-                CamelPropertiesHelper.getNonNullProperties(camelContext, 
configuration), false);
+        Optional.ofNullable(configuration.getId())
+                .ifPresent(service::setId);
+        Optional.ofNullable(configuration.getRetryPeriodMillis())
+                .ifPresent(service::setRetryPeriodMillis);
+        Optional.ofNullable(configuration.getOrder())
+                .ifPresent(service::setOrder);
+        Optional.ofNullable(configuration.getAttributes())
+                .ifPresent(service::setAttributes);
+        Optional.ofNullable(configuration.getClusterLabels())
+                .ifPresent(service::setClusterLabels);
+        Optional.ofNullable(configuration.getKubernetesNamespace())
+                .ifPresent(service::setKubernetesNamespace);
+        Optional.ofNullable(configuration.getConfigMapName())
+                .ifPresent(service::setConfigMapName);
+        Optional.ofNullable(configuration.getConnectionTimeoutMillis())
+                .ifPresent(service::setConnectionTimeoutMillis);
+        Optional.ofNullable(configuration.getJitterFactor())
+                .ifPresent(service::setJitterFactor);
+        Optional.ofNullable(configuration.getLeaseDurationMillis())
+                .ifPresent(service::setLeaseDurationMillis);
+        Optional.ofNullable(configuration.getMasterUrl())
+                .ifPresent(service::setMasterUrl);
+        Optional.ofNullable(configuration.getRenewDeadlineMillis())
+                .ifPresent(service::setRenewDeadlineMillis);
+        Optional.ofNullable(configuration.getPodName())
+                .ifPresent(service::setPodName);
 
         return service;
     }
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 c5bd1f7f7de..6347c000e1b 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,12 +16,10 @@
  */
 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.spring.boot.util.CamelPropertiesHelper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
 import org.springframework.boot.autoconfigure.AutoConfigureBefore;
@@ -31,15 +29,14 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Scope;
 
+import java.util.Optional;
+
 @Configuration
 @AutoConfigureBefore({ ClusteredRouteControllerAutoConfiguration.class, 
CamelAutoConfiguration.class })
 @ConditionalOnProperty(prefix = "camel.cluster.zookeeper", name = "enabled")
 @EnableConfigurationProperties(ZooKeeperClusterServiceConfiguration.class)
 public class ZooKeeperClusterServiceAutoConfiguration {
 
-    @Autowired
-    private CamelContext camelContext;
-
     @Autowired
     private ZooKeeperClusterServiceConfiguration configuration;
 
@@ -48,8 +45,43 @@ public class ZooKeeperClusterServiceAutoConfiguration {
     public CamelClusterService zookeeperClusterService() throws Exception {
         ZooKeeperClusterService service = new ZooKeeperClusterService();
 
-        CamelPropertiesHelper.setCamelProperties(camelContext, service,
-                CamelPropertiesHelper.getNonNullProperties(camelContext, 
configuration), false);
+        Optional.ofNullable(configuration.getId())
+                .ifPresent(service::setId);
+        Optional.ofNullable(configuration.getOrder())
+                .ifPresent(service::setOrder);
+        Optional.ofNullable(configuration.getAttributes())
+                .ifPresent(service::setAttributes);
+        Optional.ofNullable(configuration.getBasePath())
+                .ifPresent(service::setBasePath);
+        Optional.ofNullable(configuration.getNamespace())
+                .ifPresent(service::setNamespace);
+        Optional.ofNullable(configuration.getAuthInfoList())
+                .ifPresent(service::setAuthInfoList);
+        Optional.of(configuration.getConnectionTimeout())
+                .ifPresent(service::setConnectionTimeout);
+        Optional.ofNullable(configuration.getConnectionTimeoutUnit())
+                .ifPresent(service::setConnectionTimeoutUnit);
+        Optional.ofNullable(configuration.getCuratorFramework())
+                .ifPresent(service::setCuratorFramework);
+        Optional.of(configuration.getMaxCloseWait())
+                .ifPresent(service::setMaxCloseWait);
+        Optional.ofNullable(configuration.getMaxCloseWaitUnit())
+                .ifPresent(service::setMaxCloseWaitUnit);
+        Optional.ofNullable(configuration.getNodes())
+                .ifPresent(service::setNodes);
+        Optional.of(configuration.getReconnectBaseSleepTime())
+                .ifPresent(service::setReconnectBaseSleepTime);
+        Optional.ofNullable(configuration.getReconnectBaseSleepTimeUnit())
+                .ifPresent(service::setReconnectBaseSleepTimeUnit);
+        Optional.of(configuration.getReconnectMaxRetries())
+                .ifPresent(service::setReconnectMaxRetries);
+        Optional.ofNullable(configuration.getRetryPolicy())
+                .ifPresent(service::setRetryPolicy);
+        Optional.of(configuration.getSessionTimeout())
+                .ifPresent(service::setSessionTimeout);
+        Optional.ofNullable(configuration.getSessionTimeoutUnit())
+                .ifPresent(service::setSessionTimeoutUnit);
+        service.setConfiguration(configuration);
 
         return service;
     }

Reply via email to