This is an automated email from the ASF dual-hosted git repository. ffang pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 465dc801e2d [CAMEL-19057]Be able to configure SpringJAXRSServerFactoryBean with performInvocation property 465dc801e2d is described below commit 465dc801e2dc48fc57e450c76d200cf1e5a35e4e Author: Freeman Fang <freeman.f...@gmail.com> AuthorDate: Wed Feb 15 15:50:14 2023 -0500 [CAMEL-19057]Be able to configure SpringJAXRSServerFactoryBean with performInvocation property --- .../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; + } }