Java JAX-RS的注释继承不起作用

Java JAX-RS的注释继承不起作用,java,cxf,jax-rs,cxfrs,Java,Cxf,Jax Rs,Cxfrs,rest-server.xml: <jaxrs:server id="baseApi" address="http://localhost:8080/myfashions/catalog"> <jaxrs:serviceBeans> <bean class="com.myfashions.api.service.rest.implementation.CatalogServiceImpl"/> </jaxrs:servic

rest-server.xml:

<jaxrs:server id="baseApi" address="http://localhost:8080/myfashions/catalog">
    <jaxrs:serviceBeans>
        <bean class="com.myfashions.api.service.rest.implementation.CatalogServiceImpl"/>
    </jaxrs:serviceBeans>
    <jaxrs:providers>
        <ref bean="customRequestHandler"/>
        <ref bean="customResponseHandler"/>
        <ref bean="restExceptionMapper"/>
        <bean class="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider"/>
    </jaxrs:providers>
</jaxrs:server>
类别:

@Service
@Path("/myfashions/catalog")
public class CatalogServiceImpl implements CatalogService {
    @Override
    public SelectCategoryBeanList getMyfashionCategories() {
        ...
        ...
    }
}

当我打电话给
http://localhost:8080/myfashions/catalog/categories
,我没有找到与请求路径匹配的根资源。已找到路径
/myfashions/catalog/categories
,相对路径:
/categories
异常。有人能帮我吗。

地址的结构如下:

http(s)://<host>:<port>/<webapp>/<servlet URL-pattern>/<jaxrs:server address>/<resources>
您需要:

webapp name = myApp
servlet url-pattern = /rest/*
jaxrs:server address = myfashions
@Path on the class = /catalog
@Path on the interface (on the method) = /categories
webapp name = myfashions
servlet url-pattern = /*
jaxrs:server address = ""
@Path on the class = /catalog
@Path on the interface (on the method) = /categories
通常,只有在版本控制时,或者出于任何原因需要多个rest服务器时,我才在jaxrs:server元素上设置地址。大多数情况下,我将地址设置为“”

编辑:或者,如果需要:

http://localhost:8080/myfashions/catalog/categories
您需要:

webapp name = myApp
servlet url-pattern = /rest/*
jaxrs:server address = myfashions
@Path on the class = /catalog
@Path on the interface (on the method) = /categories
webapp name = myfashions
servlet url-pattern = /*
jaxrs:server address = ""
@Path on the class = /catalog
@Path on the interface (on the method) = /categories

我不确定是否允许您完全省略
@products
注释。它是可继承的。我已编辑我的问题。你能告诉我哪里错了吗?你能回答这个问题吗?我遇到了同样的问题。您是否尝试过将类级别的
@Path
CatalogServiceImpl
移动到
CatalogService
?另外,在cxf页面上找到了对此的解释: