You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/09/01 09:27:55 UTC

[camel] 02/02: CAMEL-13913: camel3 - components - Use BeanIntrospection instead of IntrospectionSupport

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

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 01c50dbd7a7a64ddcd3485a6bbebb5bba1a10394
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Sep 1 11:27:35 2019 +0200

    CAMEL-13913: camel3 - components - Use BeanIntrospection instead of IntrospectionSupport
---
 .../rest/swagger/RestSwaggerDelegateHttpsTest.java |  7 +++++--
 .../apache/camel/component/rest/RestComponent.java | 24 +++++++++-------------
 .../apache/camel/component/rest/RestProducer.java  | 18 ++++++++--------
 .../component/salesforce/SalesforceComponent.java  |  9 +++-----
 .../component/servicenow/ServiceNowComponent.java  |  8 ++++----
 .../apache/camel/component/sql/SqlComponent.java   |  4 ++--
 .../camel/component/twilio/TwilioEndpoint.java     |  8 ++++----
 .../component/undertow/UndertowComponent.java      |  5 ++---
 .../component/wordpress/WordpressComponent.java    |  9 ++++++--
 .../component/wordpress/WordpressEndpoint.java     |  4 ++--
 .../zookeepermaster/ZookeeperGroupSupport.java     |  2 +-
 .../group/internal/ManagedGroupFactoryBuilder.java | 15 ++++++++------
 12 files changed, 59 insertions(+), 54 deletions(-)

diff --git a/components/camel-rest-swagger/src/test/java/org/apache/camel/component/rest/swagger/RestSwaggerDelegateHttpsTest.java b/components/camel-rest-swagger/src/test/java/org/apache/camel/component/rest/swagger/RestSwaggerDelegateHttpsTest.java
index 899825c..44da41b 100644
--- a/components/camel-rest-swagger/src/test/java/org/apache/camel/component/rest/swagger/RestSwaggerDelegateHttpsTest.java
+++ b/components/camel-rest-swagger/src/test/java/org/apache/camel/component/rest/swagger/RestSwaggerDelegateHttpsTest.java
@@ -18,8 +18,9 @@ package org.apache.camel.component.rest.swagger;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
+import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.support.IntrospectionSupport;
+import org.apache.camel.spi.BeanIntrospection;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
@@ -32,7 +33,9 @@ public class RestSwaggerDelegateHttpsTest extends HttpsTest {
 
         final Component delegate = ((DefaultCamelContext) camelContext).getComponentResolver()
             .resolveComponent(componentName, camelContext);
-        IntrospectionSupport.setProperty(delegate, "sslContextParameters", createHttpsParameters(camelContext));
+
+        BeanIntrospection beanIntrospection = camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection();
+        beanIntrospection.setProperty(camelContext, delegate, "sslContextParameters", createHttpsParameters(camelContext));
         camelContext.addComponent(componentName, delegate);
 
         return camelContext;
diff --git a/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestComponent.java b/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestComponent.java
index 654bb01..1e824d6 100644
--- a/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestComponent.java
+++ b/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestComponent.java
@@ -17,7 +17,6 @@
 package org.apache.camel.component.rest;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.function.Consumer;
@@ -25,12 +24,13 @@ import java.util.function.Supplier;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
+import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.component.extension.ComponentVerifierExtension;
+import org.apache.camel.spi.BeanIntrospection;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.RestConfiguration;
 import org.apache.camel.support.CamelContextHelper;
 import org.apache.camel.support.DefaultComponent;
-import org.apache.camel.support.IntrospectionSupport;
 import org.apache.camel.support.PropertyBindingSupport;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.StringHelper;
@@ -72,9 +72,9 @@ public class RestComponent extends DefaultComponent {
         answer.setApiDoc(apiDoc);
 
         RestConfiguration config = new RestConfiguration();
-        mergeConfigurations(config, findGlobalRestConfiguration());
-        mergeConfigurations(config, getCamelContext().getRestConfiguration(cname, false));
-        mergeConfigurations(config, getCamelContext().getRestConfiguration(pname, false));
+        mergeConfigurations(getCamelContext(), config, findGlobalRestConfiguration());
+        mergeConfigurations(getCamelContext(), config, getCamelContext().getRestConfiguration(cname, false));
+        mergeConfigurations(getCamelContext(), config, getCamelContext().getRestConfiguration(pname, false));
 
         // if no explicit host was given, then fallback and use default configured host
         String h = getAndRemoveOrResolveReferenceParameter(parameters, "host", String.class, host);
@@ -232,21 +232,17 @@ public class RestComponent extends DefaultComponent {
         return conf;
     }
 
-    private RestConfiguration mergeConfigurations(RestConfiguration conf, RestConfiguration from) throws Exception {
+    private RestConfiguration mergeConfigurations(CamelContext camelContext, RestConfiguration conf, RestConfiguration from) throws Exception {
         if (conf == from) {
             return conf;
         }
         if (from != null) {
-            Map<String, Object> map = IntrospectionSupport.getNonNullProperties(from);
+            BeanIntrospection beanIntrospection = camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection();
+            Map<String, Object> map = new HashMap<>();
+            beanIntrospection.getProperties(from, map, null, false);
 
             // Remove properties as they need to be manually managed
-            Iterator<Map.Entry<String, Object>> it = map.entrySet().iterator();
-            while (it.hasNext()) {
-                Map.Entry<String, Object> entry = it.next();
-                if (entry.getValue() instanceof Map) {
-                    it.remove();
-                }
-            }
+            map.entrySet().removeIf(entry -> entry.getValue() instanceof Map);
 
             // Copy common options, will override those in conf
             PropertyBindingSupport.bindProperties(getCamelContext(), conf, map);
diff --git a/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestProducer.java b/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestProducer.java
index 2fe5950..ad4f989 100644
--- a/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestProducer.java
+++ b/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestProducer.java
@@ -31,13 +31,14 @@ import org.apache.camel.AsyncProcessor;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
+import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.Message;
 import org.apache.camel.Producer;
+import org.apache.camel.spi.BeanIntrospection;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.RestConfiguration;
 import org.apache.camel.support.AsyncProcessorConverterHelper;
 import org.apache.camel.support.DefaultAsyncProducer;
-import org.apache.camel.support.IntrospectionSupport;
 import org.apache.camel.support.PropertyBindingSupport;
 import org.apache.camel.support.service.ServiceHelper;
 import org.apache.camel.util.CollectionStringBuffer;
@@ -300,6 +301,7 @@ public class RestProducer extends DefaultAsyncProducer {
             throw new IllegalArgumentException("JSon DataFormat " + name + " not found.");
         }
 
+        BeanIntrospection beanIntrospection = camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection();
         if (json != null) {
             Class<?> clazz = null;
             if (type != null) {
@@ -307,8 +309,8 @@ public class RestProducer extends DefaultAsyncProducer {
                 clazz = camelContext.getClassResolver().resolveMandatoryClass(typeName);
             }
             if (clazz != null) {
-                IntrospectionSupport.setProperty(camelContext.getTypeConverter(), json, "unmarshalType", clazz);
-                IntrospectionSupport.setProperty(camelContext.getTypeConverter(), json, "useList", type.endsWith("[]"));
+                beanIntrospection.setProperty(camelContext, json, "unmarshalType", clazz);
+                beanIntrospection.setProperty(camelContext, json, "useList", type.endsWith("[]"));
             }
             setAdditionalConfiguration(configuration, camelContext, json, "json.in.");
 
@@ -318,8 +320,8 @@ public class RestProducer extends DefaultAsyncProducer {
                 outClazz = camelContext.getClassResolver().resolveMandatoryClass(typeName);
             }
             if (outClazz != null) {
-                IntrospectionSupport.setProperty(camelContext.getTypeConverter(), outJson, "unmarshalType", outClazz);
-                IntrospectionSupport.setProperty(camelContext.getTypeConverter(), outJson, "useList", outType.endsWith("[]"));
+                beanIntrospection.setProperty(camelContext, outJson, "unmarshalType", outClazz);
+                beanIntrospection.setProperty(camelContext, outJson, "useList", outType.endsWith("[]"));
             }
             setAdditionalConfiguration(configuration, camelContext, outJson, "json.out.");
         }
@@ -352,7 +354,7 @@ public class RestProducer extends DefaultAsyncProducer {
             }
             if (clazz != null) {
                 JAXBContext jc = JAXBContext.newInstance(clazz);
-                IntrospectionSupport.setProperty(camelContext.getTypeConverter(), jaxb, "context", jc);
+                beanIntrospection.setProperty(camelContext, jaxb, "context", jc);
             }
             setAdditionalConfiguration(configuration, camelContext, jaxb, "xml.in.");
 
@@ -363,11 +365,11 @@ public class RestProducer extends DefaultAsyncProducer {
             }
             if (outClazz != null) {
                 JAXBContext jc = JAXBContext.newInstance(outClazz);
-                IntrospectionSupport.setProperty(camelContext.getTypeConverter(), outJaxb, "context", jc);
+                beanIntrospection.setProperty(camelContext, outJaxb, "context", jc);
             } else if (clazz != null) {
                 // fallback and use the context from the input
                 JAXBContext jc = JAXBContext.newInstance(clazz);
-                IntrospectionSupport.setProperty(camelContext.getTypeConverter(), outJaxb, "context", jc);
+                beanIntrospection.setProperty(camelContext, outJaxb, "context", jc);
             }
             setAdditionalConfiguration(configuration, camelContext, outJaxb, "xml.out.");
         }
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java
index bde2318..bd5e214 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java
@@ -680,18 +680,15 @@ public class SalesforceComponent extends DefaultComponent implements SSLContextP
     static RestClient createRestClient(final CamelContext camelContext, final Map<String, Object> properties) throws Exception {
 
         final SalesforceEndpointConfig config = new SalesforceEndpointConfig();
-        // let's work with a copy for IntrospectionSupport so original
-        // properties are intact
+        // let's work with a copy so original properties are intact
         PropertyBindingSupport.bindProperties(camelContext, config, new HashMap<>(properties));
 
         final SalesforceLoginConfig loginConfig = new SalesforceLoginConfig();
-        // let's work with a copy for IntrospectionSupport so original
-        // properties are intact
+        // let's work with a copy so original properties are intact
         PropertyBindingSupport.bindProperties(camelContext, loginConfig, new HashMap<>(properties));
 
         final SSLContextParameters sslContextParameters = Optional.ofNullable(camelContext.getSSLContextParameters()).orElseGet(() -> new SSLContextParameters());
-        // let's work with a copy for IntrospectionSupport so original
-        // properties are intact
+        // let's work with a copy so original properties are intact
         PropertyBindingSupport.bindProperties(camelContext, sslContextParameters, new HashMap<>(properties));
 
         final SslContextFactory sslContextFactory = new SslContextFactory();
diff --git a/components/camel-servicenow/camel-servicenow-component/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponent.java b/components/camel-servicenow/camel-servicenow-component/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponent.java
index ce85d7d..20a1124 100644
--- a/components/camel-servicenow/camel-servicenow-component/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponent.java
+++ b/components/camel-servicenow/camel-servicenow-component/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponent.java
@@ -26,8 +26,8 @@ import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
 import org.apache.camel.support.EndpointHelper;
-import org.apache.camel.support.IntrospectionSupport;
 import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.PropertiesHelper;
 
 /**
  * Represents the component that manages {@link ServiceNowEndpoint}.
@@ -230,21 +230,21 @@ public class ServiceNowComponent extends DefaultComponent implements SSLContextP
         final CamelContext context = getCamelContext();
         final ServiceNowConfiguration configuration = this.configuration.copy();
 
-        Map<String, Object> models = IntrospectionSupport.extractProperties(parameters, "model.");
+        Map<String, Object> models = PropertiesHelper.extractProperties(parameters, "model.");
         for (Map.Entry<String, Object> entry : models.entrySet()) {
             configuration.addModel(
                 entry.getKey(),
                 EndpointHelper.resolveParameter(context, (String)entry.getValue(), Class.class));
         }
 
-        Map<String, Object> requestModels = IntrospectionSupport.extractProperties(parameters, "requestModel.");
+        Map<String, Object> requestModels = PropertiesHelper.extractProperties(parameters, "requestModel.");
         for (Map.Entry<String, Object> entry : requestModels.entrySet()) {
             configuration.addRequestModel(
                 entry.getKey(),
                 EndpointHelper.resolveParameter(context, (String)entry.getValue(), Class.class));
         }
 
-        Map<String, Object> responseModels = IntrospectionSupport.extractProperties(parameters, "responseModel.");
+        Map<String, Object> responseModels = PropertiesHelper.extractProperties(parameters, "responseModel.");
         for (Map.Entry<String, Object> entry : responseModels.entrySet()) {
             configuration.addResponseModel(
                 entry.getKey(),
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlComponent.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlComponent.java
index 24f3d42..0b7133a 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlComponent.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/SqlComponent.java
@@ -26,8 +26,8 @@ import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.CamelContextHelper;
 import org.apache.camel.support.DefaultComponent;
-import org.apache.camel.support.IntrospectionSupport;
 import org.apache.camel.support.PropertyBindingSupport;
+import org.apache.camel.util.PropertiesHelper;
 import org.springframework.jdbc.core.JdbcTemplate;
 
 /**
@@ -89,7 +89,7 @@ public class SqlComponent extends DefaultComponent {
         String parameterPlaceholderSubstitute = getAndRemoveParameter(parameters, "placeholder", String.class, "#");
 
         JdbcTemplate jdbcTemplate = new JdbcTemplate(target);
-        Map<String, Object> templateOptions = IntrospectionSupport.extractProperties(parameters, "template.");
+        Map<String, Object> templateOptions = PropertiesHelper.extractProperties(parameters, "template.");
         PropertyBindingSupport.bindProperties(getCamelContext(), jdbcTemplate, templateOptions);
 
         String query = remaining;
diff --git a/components/camel-twilio/src/main/java/org/apache/camel/component/twilio/TwilioEndpoint.java b/components/camel-twilio/src/main/java/org/apache/camel/component/twilio/TwilioEndpoint.java
index 563c146..82dc354 100644
--- a/components/camel-twilio/src/main/java/org/apache/camel/component/twilio/TwilioEndpoint.java
+++ b/components/camel-twilio/src/main/java/org/apache/camel/component/twilio/TwilioEndpoint.java
@@ -23,17 +23,17 @@ import java.util.Map;
 
 import com.twilio.http.TwilioRestClient;
 import org.apache.camel.Consumer;
+import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.TypeConverter;
 import org.apache.camel.component.twilio.internal.TwilioApiCollection;
 import org.apache.camel.component.twilio.internal.TwilioApiName;
 import org.apache.camel.component.twilio.internal.TwilioConstants;
 import org.apache.camel.component.twilio.internal.TwilioPropertiesHelper;
+import org.apache.camel.spi.BeanIntrospection;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
-import org.apache.camel.support.IntrospectionSupport;
 import org.apache.camel.support.component.AbstractApiEndpoint;
 import org.apache.camel.support.component.ApiMethod;
 import org.apache.camel.support.component.ApiMethodPropertiesHelper;
@@ -104,9 +104,9 @@ public class TwilioEndpoint extends AbstractApiEndpoint<TwilioApiName, TwilioCon
         }
         String methodName = EXECUTOR_METHOD_MAP.get(method.getName());
         try {
-            TypeConverter typeConverter = getCamelContext().getTypeConverter();
+            BeanIntrospection beanIntrospection = getCamelContext().adapt(ExtendedCamelContext.class).getBeanIntrospection();
             for (Map.Entry<String, Object> p : properties.entrySet()) {
-                IntrospectionSupport.setProperty(typeConverter, executor, p.getKey(), p.getValue());
+                beanIntrospection.setProperty(getCamelContext(), executor, p.getKey(), p.getValue());
             }
             return doExecute(executor, methodName, properties);
         } catch (Exception e) {
diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
index 57f9ec4..47b613c 100644
--- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
+++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java
@@ -24,7 +24,6 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
-
 import javax.net.ssl.SSLContext;
 
 import io.undertow.server.HttpHandler;
@@ -42,13 +41,13 @@ import org.apache.camel.spi.RestConsumerFactory;
 import org.apache.camel.spi.RestProducerFactory;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
-import org.apache.camel.support.IntrospectionSupport;
 import org.apache.camel.support.RestProducerFactoryHelper;
 import org.apache.camel.support.jsse.SSLContextParameters;
 import org.apache.camel.support.service.ServiceHelper;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.HostUtils;
 import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.PropertiesHelper;
 import org.apache.camel.util.URISupport;
 import org.apache.camel.util.UnsafeUriCharactersEncoder;
 
@@ -87,7 +86,7 @@ public class UndertowComponent extends DefaultComponent implements RestConsumerF
         URI endpointUri = URISupport.createRemainingURI(uriHttpUriAddress, parameters);
 
         // any additional channel options
-        Map<String, Object> options = IntrospectionSupport.extractProperties(parameters, "option.");
+        Map<String, Object> options = PropertiesHelper.extractProperties(parameters, "option.");
 
         // determine sslContextParameters
         SSLContextParameters sslParams = this.sslContextParameters;
diff --git a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponent.java b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponent.java
index aee3098..87c5b25 100644
--- a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponent.java
+++ b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponent.java
@@ -21,10 +21,11 @@ import java.util.Map;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
+import org.apache.camel.ExtendedCamelContext;
+import org.apache.camel.spi.BeanIntrospection;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.DefaultComponent;
-import org.apache.camel.support.IntrospectionSupport;
 import org.apache.camel.support.PropertyBindingSupport;
 
 /**
@@ -82,7 +83,11 @@ public class WordpressComponent extends DefaultComponent {
 
     private WordpressComponentConfiguration copyComponentProperties() throws Exception {
         Map<String, Object> componentProperties = new HashMap<>();
-        IntrospectionSupport.getProperties(configuration, componentProperties, null, false);
+
+        if (configuration != null) {
+            BeanIntrospection beanIntrospection = getCamelContext().adapt(ExtendedCamelContext.class).getBeanIntrospection();
+            beanIntrospection.getProperties(configuration, componentProperties, null, false);
+        }
 
         // create endpoint configuration with component properties
         WordpressComponentConfiguration config = new WordpressComponentConfiguration();
diff --git a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressEndpoint.java b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressEndpoint.java
index 3f3bd3e..a622686 100644
--- a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressEndpoint.java
+++ b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressEndpoint.java
@@ -37,9 +37,9 @@ import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriPath;
 import org.apache.camel.support.DefaultEndpoint;
-import org.apache.camel.support.IntrospectionSupport;
 import org.apache.camel.support.PropertyBindingSupport;
 import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.PropertiesHelper;
 
 /**
  * Integrates Camel with Wordpress.
@@ -123,7 +123,7 @@ public class WordpressEndpoint extends DefaultEndpoint {
 
             if (configuration.getSearchCriteria() == null) {
                 final SearchCriteria searchCriteria = WordpressOperationType.valueOf(operation).getCriteriaType().newInstance();
-                Map<String, Object> criteriaOptions = IntrospectionSupport.extractProperties(options, "criteria.");
+                Map<String, Object> criteriaOptions = PropertiesHelper.extractProperties(options, "criteria.");
                 // any property that has a "," should be a List
                 criteriaOptions = criteriaOptions.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> {
                     if (e.toString().contains(",")) {
diff --git a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/ZookeeperGroupSupport.java b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/ZookeeperGroupSupport.java
index a5a8c17..3b6ec4a 100644
--- a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/ZookeeperGroupSupport.java
+++ b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/ZookeeperGroupSupport.java
@@ -139,7 +139,7 @@ public class ZookeeperGroupSupport extends ServiceSupport implements CamelContex
         }
 
         // will auto create curator if needed
-        managedGroupFactory = ManagedGroupFactoryBuilder.create(curator, getClass().getClassLoader(), getCamelContext().getClassResolver(), this);
+        managedGroupFactory = ManagedGroupFactoryBuilder.create(curator, getClass().getClassLoader(), getCamelContext(), this);
     }
 
     @Override
diff --git a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ManagedGroupFactoryBuilder.java b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ManagedGroupFactoryBuilder.java
index aa899f3..0b62dd9 100644
--- a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ManagedGroupFactoryBuilder.java
+++ b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ManagedGroupFactoryBuilder.java
@@ -18,8 +18,10 @@ package org.apache.camel.component.zookeepermaster.group.internal;
 
 import java.util.concurrent.Callable;
 
-import org.apache.camel.spi.ClassResolver;
-import org.apache.camel.support.IntrospectionSupport;
+import org.apache.camel.CamelContext;
+import org.apache.camel.ExtendedCamelContext;
+import org.apache.camel.spi.BeanIntrospection;
+import org.apache.camel.support.ObjectHelper;
 import org.apache.curator.framework.CuratorFramework;
 
 public final class ManagedGroupFactoryBuilder {
@@ -29,16 +31,17 @@ public final class ManagedGroupFactoryBuilder {
 
     public static ManagedGroupFactory create(CuratorFramework curator,
                                              ClassLoader loader,
-                                             ClassResolver resolver,
+                                             CamelContext camelContext,
                                              Callable<CuratorFramework> factory) throws Exception {
         if (curator != null) {
             return new StaticManagedGroupFactory(curator, false);
         }
         try {
-            Class<?> clazz = resolver.resolveClass("org.apache.camel.component.zookeepermaster.group.internal.osgi.OsgiManagedGroupFactory");
+            Class<?> clazz = camelContext.getClassResolver().resolveClass("org.apache.camel.component.zookeepermaster.group.internal.osgi.OsgiManagedGroupFactory");
             if (clazz != null) {
-                Object instance = clazz.newInstance();
-                IntrospectionSupport.setProperty(instance, "classLoader", loader);
+                Object instance = ObjectHelper.newInstance(clazz);
+                BeanIntrospection beanIntrospection = camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection();
+                beanIntrospection.setProperty(camelContext, instance, "classLoader", loader);
                 return (ManagedGroupFactory) instance;
             }
         } catch (Throwable e) {