Spring 招摇过市忽略资源中的函数
当我试图为swagger配置所有东西时,它正在工作。。在某种程度上,它忽略了函数中的函数,只考虑了类的API API。 我正在使用ApacheCxf+spring 生成的json只包含类描述,这里没有方法Spring 招摇过市忽略资源中的函数,spring,cxf,swagger,Spring,Cxf,Swagger,当我试图为swagger配置所有东西时,它正在工作。。在某种程度上,它忽略了函数中的函数,只考虑了类的API API。 我正在使用ApacheCxf+spring 生成的json只包含类描述,这里没有方法 ..."apis":[{"path":"/","description":"Entities operations"}]... 控制器的符号 @Path("/") @Api(value = "/", description = "Entities operations") @Controll
..."apis":[{"path":"/","description":"Entities operations"}]...
控制器的符号
@Path("/")
@Api(value = "/", description = "Entities operations")
@Controller
public class RepositoryResource
....
函数adnotation
@GET
@ApiOperation(value = "Method to check if this resources is up and running")
public String hello()
...
发现日志消息
Could not find a definition for bean with id {http://listing.jaxrs.swagger.wordnik.com/}ApiListingResourceJSON.http-destination
弹簧配置
<jaxrs:server id="restAPI" address="/" staticSubresourceResolution="true">
<jaxrs:serviceBeans>
<ref bean="swaggerResourceJSON"/>
<ref bean="repositoryResource"/>
</jaxrs:serviceBeans>
....
不要将root/用于@Api值-这会破坏文档。即使有@Path/,也应该有类似于@Api/root的东西 这不会影响API本身,仅在提供文档的地方 一旦进行了修改,您的/api文档将如下所示: …API:[{path:/root,description:Entities-operations}] 该资源将在/api docs/root上可用。使用swagger ui运行它将生成正确的API调用