【问题标题】:Simple binding for apache camel cxfrs without using spring不使用spring的apache camel cxfrs的简单绑定
【发布时间】:2014-09-19 21:19:18
【问题描述】:

我想使用camel的cxfrs模块提供的简单绑定而不使用spring。 apache网站上给出的例子使用了spring。 http://camel.apache.org/cxfrs.html 谁能解释如何在没有弹簧的情况下使用简单绑定?

【问题讨论】:

    标签: apache-camel cxfrs


    【解决方案1】:

    您可以使用 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)

    【讨论】:

    • 我没有找到任何这方面的文档,我只是寻找“CxfRsCompoent”和“CxfRsEndpoint”并进行了实验
    【解决方案2】:

    如果不使用 Spring,很难在 cxfrs 端点上配置所有东西。 但是您可以通过使用 uri 选项来完成大多数 cxfrs 的配置,例如

    from("cxfrs://http://localhost:9000/context/rest?resourceClasses=org.apache.camel.component.cxf.jaxrs.testbean.CustomerServiceResource&bindingStyle=SimpleConsumer")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-12
      • 2018-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-05
      • 1970-01-01
      相关资源
      最近更新 更多