You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ff...@apache.org on 2023/02/15 20:58:09 UTC

[camel] branch camel-3.20.x updated: [CAMEL-19057]Be able to configure SpringJAXRSServerFactoryBean with performInvocation property

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

ffang pushed a commit to branch camel-3.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.20.x by this push:
     new 2f1615af7df [CAMEL-19057]Be able to configure SpringJAXRSServerFactoryBean with performInvocation property
2f1615af7df is described below

commit 2f1615af7df2f9d040031d1c0453e41a813a6eb4
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Wed Feb 15 15:50:14 2023 -0500

    [CAMEL-19057]Be able to configure SpringJAXRSServerFactoryBean with performInvocation property
    
    (cherry picked from commit 465dc801e2dc48fc57e450c76d200cf1e5a35e4e)
---
 .../cxf/spring/jaxrs/SpringJAXRSServerFactoryBean.java | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/components/camel-cxf/camel-cxf-spring-rest/src/main/java/org/apache/camel/component/cxf/spring/jaxrs/SpringJAXRSServerFactoryBean.java b/components/camel-cxf/camel-cxf-spring-rest/src/main/java/org/apache/camel/component/cxf/spring/jaxrs/SpringJAXRSServerFactoryBean.java
index 3f00225ce33..2b9b51bdcaa 100644
--- a/components/camel-cxf/camel-cxf-spring-rest/src/main/java/org/apache/camel/component/cxf/spring/jaxrs/SpringJAXRSServerFactoryBean.java
+++ b/components/camel-cxf/camel-cxf-spring-rest/src/main/java/org/apache/camel/component/cxf/spring/jaxrs/SpringJAXRSServerFactoryBean.java
@@ -25,6 +25,7 @@ import org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor;
 import org.apache.cxf.ext.logging.LoggingFeature;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.JAXRSServiceFactoryBean;
+import org.apache.cxf.jaxrs.model.ClassResourceInfo;
 import org.apache.cxf.logging.FaultListener;
 import org.springframework.beans.BeansException;
 import org.springframework.context.ApplicationContext;
@@ -36,6 +37,7 @@ public class SpringJAXRSServerFactoryBean extends JAXRSServerFactoryBean
     private String beanId;
     private LoggingFeature loggingFeature;
     private int loggingSizeLimit;
+    private boolean performInvocation;
 
     public SpringJAXRSServerFactoryBean() {
     }
@@ -113,4 +115,20 @@ public class SpringJAXRSServerFactoryBean extends JAXRSServerFactoryBean
             this.getProperties().put(FaultListener.class.getName(), new NullFaultListener());
         }
     }
+
+    @Override
+    protected boolean isValidClassResourceInfo(ClassResourceInfo cri) {
+        // CXF will consider interfaces created for managing model resources
+        // invalid - however it is fine with Camel processors if no service invocation
+        // is requested.
+        return !isPerformInvocation() || !cri.getServiceClass().isInterface();
+    }
+
+    public boolean isPerformInvocation() {
+        return performInvocation;
+    }
+
+    public void setPerformInvocation(boolean performInvocation) {
+        this.performInvocation = performInvocation;
+    }
 }