2014-11-05 145 views
0

功能,当我试图配置家居招摇,它的工作..不知何故部分,它从资源忽略的功能和只考虑类@Api adnotation扬鞭忽略资源

我使用Apache CXF +弹簧

生成JSON只包含类的描述,这里

..."apis":[{"path":"/","description":"Entities operations"}]... 

没有方法的控制器adnotations

@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() 
... 

日志消息spoted

Could not find a definition for bean with id {http://listing.jaxrs.swagger.wordnik.com/}ApiListingResourceJSON.http-destination 

spring配置

<jaxrs:server id="restAPI" address="/" staticSubresourceResolution="true"> 
    <jaxrs:serviceBeans> 
     <ref bean="swaggerResourceJSON"/> 
     <ref bean="repositoryResource"/> 
    </jaxrs:serviceBeans> 
.... 

回答

0

不要为你的@Api值使用的根( “/”) - 这将打破文件。即使你有@Path("/"),你应该有类似@Api("/root")

这不会影响API本身,只有在提供文档的位置。

一旦你作出这样的修改,您/ API的文档看起来像:

..."apis":[{"path":"/root","description":"Entities operations"}]...

而这资源是可在/ API-DOCS /根。用swagger-ui运行它将产生适当的API调用。