apache-camelcxfrs

Simple binding for apache camel cxfrs without using spring


I want to use simple binding provided by cxfrs module of camel without using spring. The example given on the apache website uses spring. http://camel.apache.org/cxfrs.html Can anyone explain how to use simple binding without spring?


Solution

  • You can use the Java DSL (Domain Specific Language). An example (in a RouteBuilder#configure method):

    CxfRsComponent cxfComponent = new CxfRsComponent(context);
    CxfRsEndpoint serviceEndpoint = new CxfRsEndpoint("http:/localhost/rest", cxfComponent);
    serviceEndpoint.addResourceClass(MyService.class);
    
    from(serviceEndpoint).log("this is irrelevant");
    

    Camel version is 2.16.2 (maven: org.apache.camel:camel-cxf-transport:2.16.2) CXF version is 3.1.4 (org.apache.cxf:cxf-rt-transports-http-jetty:3.1.4)