【发布时间】:2014-09-19 21:19:18
【问题描述】:
我想使用camel的cxfrs模块提供的简单绑定而不使用spring。 apache网站上给出的例子使用了spring。 http://camel.apache.org/cxfrs.html 谁能解释如何在没有弹簧的情况下使用简单绑定?
【问题讨论】:
标签: apache-camel cxfrs
我想使用camel的cxfrs模块提供的简单绑定而不使用spring。 apache网站上给出的例子使用了spring。 http://camel.apache.org/cxfrs.html 谁能解释如何在没有弹簧的情况下使用简单绑定?
【问题讨论】:
标签: apache-camel cxfrs
您可以使用 Java DSL(领域特定语言)。一个示例(在 RouteBuilder#configure 方法中):
CxfRsComponent cxfComponent = new CxfRsComponent(context);
CxfRsEndpoint serviceEndpoint = new CxfRsEndpoint("http:/localhost/rest", cxfComponent);
serviceEndpoint.addResourceClass(MyService.class);
from(serviceEndpoint).log("this is irrelevant");
Camel 版本是 2.16.2 (maven: org.apache.camel:camel-cxf-transport:2.16.2) CXF 版本是 3.1.4 (org.apache.cxf:cxf-rt-transports-http-jetty :3.1.4)
【讨论】:
如果不使用 Spring,很难在 cxfrs 端点上配置所有东西。 但是您可以通过使用 uri 选项来完成大多数 cxfrs 的配置,例如
from("cxfrs://http://localhost:9000/context/rest?resourceClasses=org.apache.camel.component.cxf.jaxrs.testbean.CustomerServiceResource&bindingStyle=SimpleConsumer")
【讨论】: