Spring cxf rest多个端点

Spring cxf rest多个端点,spring,rest,cxf,Spring,Rest,Cxf,我已经使用cxf从wadl文件生成了java类。定义了3个资源,创建了3个带有@PATH注释的服务类。现在我想将它们发布到同一个url,但我不确定如何实现这一点。 下面是这些类和wadl的片段。最后一部分显示了beans.xml——这是我知道如何发布端点的唯一方法。还有其他方法吗?我如何将这3个类发布到基本url/中,然后它们应该与注释相关的路径匹配。也许是一个包装类,但我不确定 班级 @Path("status") public class Status { ...

我已经使用cxf从wadl文件生成了java类。定义了3个资源,创建了3个带有@PATH注释的服务类。现在我想将它们发布到同一个url,但我不确定如何实现这一点。 下面是这些类和wadl的片段。最后一部分显示了beans.xml——这是我知道如何发布端点的唯一方法。还有其他方法吗?我如何将这3个类发布到基本url/中,然后它们应该与注释相关的路径匹配。也许是一个包装类,但我不确定

班级

    @Path("status")
    public class Status {
    ...
    @Path("status/{id}")
    public class StatusId {
    ...
    @Path("counters")
    public class Counters{
    ...
小河

beans.xml

   <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:jaxrs="http://cxf.apache.org/jaxrs"
      xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://cxf.apache.org/jaxrs
    http://cxf.apache.org/schemas/jaxrs.xsd">

      <!-- do not use import statements if CXFServlet init parameters link to this beans.xml -->

      <import resource="classpath:META-INF/cxf/cxf.xml" />
      <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

      <jaxrs:server id="statusService" address="/">
        <jaxrs:serviceBeans>
          <ref bean="status" />
        </jaxrs:serviceBeans>
      </jaxrs:server>

    <!-- causes error
    <jaxrs:server id="statusServiceId" address="/">  
        <jaxrs:serviceBeans>
          <ref bean="statusId" />
        </jaxrs:serviceBeans>
      </jaxrs:server>


    <jaxrs:server id="counterServiceId" address="/">  
        <jaxrs:serviceBeans>
          <ref bean="counters" />
        </jaxrs:serviceBeans>
      </jaxrs:server>
   --> 

      <bean id="status" class="package.Status"/>
      <bean id="statusId" class="package.StatusId"/>
      <bean id="counters" class="package.Counters"/>

    </beans>

用于获取多个端点 beans.xml应该像下面这样

<jaxrs:server id="statusService" address="/">
        <jaxrs:serviceBeans>
          <ref bean="status" />
          <ref bean="statusId" />
          <ref bean="counters" />
        </jaxrs:serviceBeans>
      </jaxrs:server>
<jaxrs:server id="statusService" address="/">
        <jaxrs:serviceBeans>
          <ref bean="status" />
          <ref bean="statusId" />
          <ref bean="counters" />
        </jaxrs:serviceBeans>
      </jaxrs:server>