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

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

commit c12137f10418390ad94030742fee10d9c0aea8e7
Author: Willian Antunes <willian.lima.antu...@gmail.com>
AuthorDate: Sun May 27 16:43:08 2018 -0300

    CAMEL-12541: In order to make CxfRsProducer cache works properly
---
 .../camel/component/cxf/jaxrs/CxfRsSpringEndpoint.java    | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpoint.java
 
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpoint.java
index bd51da1..46b235a 100644
--- 
a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpoint.java
+++ 
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpoint.java
@@ -25,6 +25,7 @@ import org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
 import org.springframework.context.ApplicationContext;
+import org.springframework.util.ReflectionUtils;
 
 public class CxfRsSpringEndpoint extends CxfRsEndpoint implements BeanIdAware {
     private AbstractJAXRSFactoryBean bean;
@@ -70,7 +71,7 @@ public class CxfRsSpringEndpoint extends CxfRsEndpoint 
implements BeanIdAware {
     @Override
     protected JAXRSClientFactoryBean newJAXRSClientFactoryBean() {
         checkBeanType(bean, JAXRSClientFactoryBean.class);
-        return (JAXRSClientFactoryBean)bean;
+        return newInstanceWithCommonProperties();
     }
 
     @Override
@@ -89,4 +90,14 @@ public class CxfRsSpringEndpoint extends CxfRsEndpoint 
implements BeanIdAware {
     public void setBeanId(String id) {
         this.beanId = id;
     }
-}
+    
+    private JAXRSClientFactoryBean newInstanceWithCommonProperties() {
+        SpringJAXRSClientFactoryBean cfb = new SpringJAXRSClientFactoryBean();
+        
+        if (bean instanceof SpringJAXRSClientFactoryBean) {
+            ReflectionUtils.shallowCopyFieldState(bean, cfb);
+        }
+
+        return cfb;
+    }    
+}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
ningji...@apache.org.

Reply via email to