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

davsclaus 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 8a5c5b1c0461 CAMEL-27446: camel-cxf - test cxfrs providers in the 
endpoint URI, and say that one List bean works too (#31084)
8a5c5b1c0461 is described below

commit 8a5c5b1c04610e5d0be0aa97ca96a6e455fd2c70
Author: Saravanakumar Selvaraj <[email protected]>
AuthorDate: Mon Nov 30 08:33:44 2026 +0000

    CAMEL-27446: camel-cxf - test cxfrs providers in the endpoint URI, and say 
that one List bean works too (#31084)
    
    * CAMEL-27446: camel-cxf - test cxfrs providers in the endpoint URI, and 
say that one List bean works too
    * CAMEL-27446: camel-cxf - drop the empty string from the endpoint URI of 
the two new cxfrs tests
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 .../org/apache/camel/catalog/components/cxfrs.json |  2 +-
 .../apache/camel/component/cxf/jaxrs/cxfrs.json    |  2 +-
 .../camel/component/cxf/jaxrs/CxfRsEndpoint.java   |  3 +-
 .../component/cxf/jaxrs/CxfRsEndpointTest.java     | 41 ++++++++++++++++++++++
 .../endpoint/dsl/CxfRsEndpointBuilderFactory.java  | 15 ++++----
 5 files changed, 54 insertions(+), 9 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/cxfrs.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/cxfrs.json
index 439ad0a204db..193766a08624 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/cxfrs.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/cxfrs.json
@@ -62,7 +62,7 @@
     "address": { "index": 1, "kind": "path", "displayName": "Address", 
"group": "common", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "The service address, for example 
http:\/\/localhost:9000\/rest. The consumer receives requests at this address, 
and the producer sends requests to it. The CamelDestinationOverrideUrl header 
replaces this address for a request that the producer se [...]
     "features": { "index": 2, "kind": "parameter", "displayName": "Features", 
"group": "common", "label": "", "required": false, "type": "array", "javaType": 
"java.util.List<org.apache.cxf.feature.Feature>", "deprecated": false, 
"autowired": false, "secret": false, "description": "The CXF features to add to 
the server that the consumer creates and to each client that the producer 
creates, as a List of org.apache.cxf.feature.Feature. Written in the endpoint 
URI as bean ids with the prefix [...]
     "modelRef": { "index": 3, "kind": "parameter", "displayName": "Model Ref", 
"group": "common", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "The location of a CXF user model, for example 
classpath:\/model\/customers.xml. The model is an XML document that describes 
resources and their operations in place of JAX-RS annotations, and the name 
attribute of each resource names its r [...]
-    "providers": { "index": 4, "kind": "parameter", "displayName": 
"Providers", "group": "common", "label": "", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The JAX-RS providers to add to the 
server that the consumer creates and to each client that the producer creates, 
for example a MessageBodyReader and MessageBodyWriter for JSON. Written in the 
endpoint URI as bean ids with the prefix #,  [...]
+    "providers": { "index": 4, "kind": "parameter", "displayName": 
"Providers", "group": "common", "label": "", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The JAX-RS providers to add to the 
server that the consumer creates and to each client that the producer creates, 
for example a MessageBodyReader and MessageBodyWriter for JSON. Written in the 
endpoint URI as bean ids with the prefix #,  [...]
     "resourceClasses": { "index": 5, "kind": "parameter", "displayName": 
"Resource Classes", "group": "common", "label": "", "required": false, "type": 
"array", "javaType": "java.util.List<java.lang.Class<java.lang.Object>>", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
JAX-RS resource classes. Written in the endpoint URI as fully qualified class 
names, separated by commas. The consumer serves them as root resources, and a 
resource class can be an interfa [...]
     "schemaLocations": { "index": 6, "kind": "parameter", "displayName": 
"Schema Locations", "group": "common", "label": "", "required": false, "type": 
"array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, 
"autowired": false, "secret": false, "description": "Sets the locations of the 
schema(s) which can be used to validate the incoming XML or JAXB-driven JSON." 
},
     "skipFaultLogging": { "index": 7, "kind": "parameter", "displayName": 
"Skip Fault Logging", "group": "common", "label": "", "required": false, 
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": false, "description": "Whether to skip 
the log entry that the PhaseInterceptorChain writes when an interceptor throws 
an exception. Sets the CXF property org.apache.cxf.logging.FaultListener to a 
FaultListener that skips this log [...]
diff --git 
a/components/camel-cxf/camel-cxf-rest/src/generated/resources/META-INF/org/apache/camel/component/cxf/jaxrs/cxfrs.json
 
b/components/camel-cxf/camel-cxf-rest/src/generated/resources/META-INF/org/apache/camel/component/cxf/jaxrs/cxfrs.json
index 439ad0a204db..193766a08624 100644
--- 
a/components/camel-cxf/camel-cxf-rest/src/generated/resources/META-INF/org/apache/camel/component/cxf/jaxrs/cxfrs.json
+++ 
b/components/camel-cxf/camel-cxf-rest/src/generated/resources/META-INF/org/apache/camel/component/cxf/jaxrs/cxfrs.json
@@ -62,7 +62,7 @@
     "address": { "index": 1, "kind": "path", "displayName": "Address", 
"group": "common", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "The service address, for example 
http:\/\/localhost:9000\/rest. The consumer receives requests at this address, 
and the producer sends requests to it. The CamelDestinationOverrideUrl header 
replaces this address for a request that the producer se [...]
     "features": { "index": 2, "kind": "parameter", "displayName": "Features", 
"group": "common", "label": "", "required": false, "type": "array", "javaType": 
"java.util.List<org.apache.cxf.feature.Feature>", "deprecated": false, 
"autowired": false, "secret": false, "description": "The CXF features to add to 
the server that the consumer creates and to each client that the producer 
creates, as a List of org.apache.cxf.feature.Feature. Written in the endpoint 
URI as bean ids with the prefix [...]
     "modelRef": { "index": 3, "kind": "parameter", "displayName": "Model Ref", 
"group": "common", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "The location of a CXF user model, for example 
classpath:\/model\/customers.xml. The model is an XML document that describes 
resources and their operations in place of JAX-RS annotations, and the name 
attribute of each resource names its r [...]
-    "providers": { "index": 4, "kind": "parameter", "displayName": 
"Providers", "group": "common", "label": "", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The JAX-RS providers to add to the 
server that the consumer creates and to each client that the producer creates, 
for example a MessageBodyReader and MessageBodyWriter for JSON. Written in the 
endpoint URI as bean ids with the prefix #,  [...]
+    "providers": { "index": 4, "kind": "parameter", "displayName": 
"Providers", "group": "common", "label": "", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The JAX-RS providers to add to the 
server that the consumer creates and to each client that the producer creates, 
for example a MessageBodyReader and MessageBodyWriter for JSON. Written in the 
endpoint URI as bean ids with the prefix #,  [...]
     "resourceClasses": { "index": 5, "kind": "parameter", "displayName": 
"Resource Classes", "group": "common", "label": "", "required": false, "type": 
"array", "javaType": "java.util.List<java.lang.Class<java.lang.Object>>", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
JAX-RS resource classes. Written in the endpoint URI as fully qualified class 
names, separated by commas. The consumer serves them as root resources, and a 
resource class can be an interfa [...]
     "schemaLocations": { "index": 6, "kind": "parameter", "displayName": 
"Schema Locations", "group": "common", "label": "", "required": false, "type": 
"array", "javaType": "java.util.List<java.lang.String>", "deprecated": false, 
"autowired": false, "secret": false, "description": "Sets the locations of the 
schema(s) which can be used to validate the incoming XML or JAXB-driven JSON." 
},
     "skipFaultLogging": { "index": 7, "kind": "parameter", "displayName": 
"Skip Fault Logging", "group": "common", "label": "", "required": false, 
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": false, "description": "Whether to skip 
the log entry that the PhaseInterceptorChain writes when an interceptor throws 
an exception. Sets the CXF property org.apache.cxf.logging.FaultListener to a 
FaultListener that skips this log [...]
diff --git 
a/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
 
b/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
index ebc90a68fb50..427107d634f7 100644
--- 
a/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
+++ 
b/components/camel-cxf/camel-cxf-rest/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
@@ -199,7 +199,8 @@ public class CxfRsEndpoint extends DefaultEndpoint 
implements HeaderFilterStrate
               description = "The JAX-RS providers to add to the server that 
the consumer creates and to each client that the"
                             + " producer creates, for example a 
MessageBodyReader and MessageBodyWriter for JSON. Written in"
                             + " the endpoint URI as bean ids with the prefix 
#, separated by commas, for example"
-                            + " #jsonProvider,#xmlProvider. The built-in CXF 
providers stay registered.")
+                            + " #jsonProvider,#xmlProvider. One bean that is a 
List of providers works too, for example"
+                            + " #myProviders. The built-in CXF providers stay 
registered.")
     private List<Object> providers = new LinkedList<>();
     private String providersRef;
     @UriParam
diff --git 
a/components/camel-cxf/camel-cxf-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpointTest.java
 
b/components/camel-cxf/camel-cxf-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpointTest.java
index 1e455827e307..6c5ff28faa54 100644
--- 
a/components/camel-cxf/camel-cxf-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpointTest.java
+++ 
b/components/camel-cxf/camel-cxf-rest/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpointTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.cxf.jaxrs;
 
+import java.util.List;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.component.cxf.jaxrs.testbean.CustomerService;
 import org.apache.camel.impl.DefaultCamelContext;
@@ -23,6 +25,7 @@ import org.apache.camel.test.AvailablePortFinder;
 import org.apache.camel.test.junit6.CamelTestSupport;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
+import org.apache.cxf.jaxrs.provider.JAXBElementProvider;
 import org.apache.cxf.jaxrs.provider.json.JSONProvider;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
@@ -120,6 +123,44 @@ public class CxfRsEndpointTest extends CamelTestSupport {
         }
     }
 
+    @Test
+    public void testCxfRsEndpointProvidersBeanIds() throws Exception {
+        JSONProvider<?> jsonProvider = new JSONProvider<>();
+        JAXBElementProvider<?> xmlProvider = new JAXBElementProvider<>();
+        context.getRegistry().bind("jsonProvider", jsonProvider);
+        context.getRegistry().bind("xmlProvider", xmlProvider);
+
+        String endpointUri = "cxfrs://http://localhost:"; + CTX
+                             + 
"?resourceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"
+                             + "&providers=#jsonProvider,#xmlProvider";
+
+        // as in a route, the context creates the endpoint with the generated 
configurer and starts it
+        CxfRsEndpoint endpoint = context.getEndpoint(endpointUri, 
CxfRsEndpoint.class);
+        JAXRSServerFactoryBean sfb = endpoint.createJAXRSServerFactoryBean();
+        assertEquals(List.of(jsonProvider, xmlProvider), sfb.getProviders(), 
"Get wrong providers");
+        JAXRSClientFactoryBean cfb = endpoint.createJAXRSClientFactoryBean();
+        assertEquals(List.of(jsonProvider, xmlProvider), cfb.getProviders(), 
"Get wrong providers");
+    }
+
+    @Test
+    public void testCxfRsEndpointProvidersListBean() throws Exception {
+        JSONProvider<?> jsonProvider = new JSONProvider<>();
+        JAXBElementProvider<?> xmlProvider = new JAXBElementProvider<>();
+        context.getRegistry().bind("myProviders", List.of(jsonProvider, 
xmlProvider));
+
+        String endpointUri = "cxfrs://http://localhost:"; + CTX
+                             + 
"?resourceClass=org.apache.camel.component.cxf.jaxrs.testbean.CustomerService"
+                             + "&providers=#myProviders";
+
+        // as in a route, the context creates the endpoint with the generated 
configurer and starts it
+        CxfRsEndpoint endpoint = context.getEndpoint(endpointUri, 
CxfRsEndpoint.class);
+        // the endpoint keeps the List as one element, and setProviders of the 
CXF factory beans adds the List elements
+        JAXRSServerFactoryBean sfb = endpoint.createJAXRSServerFactoryBean();
+        assertEquals(List.of(jsonProvider, xmlProvider), sfb.getProviders(), 
"Get wrong providers");
+        JAXRSClientFactoryBean cfb = endpoint.createJAXRSClientFactoryBean();
+        assertEquals(List.of(jsonProvider, xmlProvider), cfb.getProviders(), 
"Get wrong providers");
+    }
+
     @Test
     public void testCxfRsEndpointCamelContextAware() throws Exception {
         String endpointUri = "cxfrs://simple";
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CxfRsEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CxfRsEndpointBuilderFactory.java
index 516f1594ba91..c4de1086f2dd 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CxfRsEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CxfRsEndpointBuilderFactory.java
@@ -111,8 +111,9 @@ public interface CxfRsEndpointBuilderFactory {
          * and to each client that the producer creates, for example a
          * MessageBodyReader and MessageBodyWriter for JSON. Written in the
          * endpoint URI as bean ids with the prefix #, separated by commas, for
-         * example #jsonProvider,#xmlProvider. The built-in CXF providers stay
-         * registered.
+         * example #jsonProvider,#xmlProvider. One bean that is a List of
+         * providers works too, for example #myProviders. The built-in CXF
+         * providers stay registered.
          * 
          * The option is a: <code>java.lang.String</code> type.
          * 
@@ -950,8 +951,9 @@ public interface CxfRsEndpointBuilderFactory {
          * and to each client that the producer creates, for example a
          * MessageBodyReader and MessageBodyWriter for JSON. Written in the
          * endpoint URI as bean ids with the prefix #, separated by commas, for
-         * example #jsonProvider,#xmlProvider. The built-in CXF providers stay
-         * registered.
+         * example #jsonProvider,#xmlProvider. One bean that is a List of
+         * providers works too, for example #myProviders. The built-in CXF
+         * providers stay registered.
          * 
          * The option is a: <code>java.lang.String</code> type.
          * 
@@ -1904,8 +1906,9 @@ public interface CxfRsEndpointBuilderFactory {
          * and to each client that the producer creates, for example a
          * MessageBodyReader and MessageBodyWriter for JSON. Written in the
          * endpoint URI as bean ids with the prefix #, separated by commas, for
-         * example #jsonProvider,#xmlProvider. The built-in CXF providers stay
-         * registered.
+         * example #jsonProvider,#xmlProvider. One bean that is a List of
+         * providers works too, for example #myProviders. The built-in CXF
+         * providers stay registered.
          * 
          * The option is a: <code>java.lang.String</code> type.
          * 

Reply via email to