If you wanted to do this yourself, you could approach it like this:
Create an AnnotationReader implementation that scans for the various @Path annotations
Test that it is capable of reading the name attribute
Create a Maven mojo that wraps this scanning functionality
Add in the facility to map the regex parameters (e.g. {customerId}) into something meaningful for documentation purposes - perhaps by reading the associated Javadoc.
The annotation reader won't have to do any modifications to the existing annotations so it should be straightforward to build up a list of the endpoint regular expressions. In combination with the Javadocs you should be able to create a useful tool. I'd certainly find it useful, and perhaps others would too.
发布评论
评论(3)
你应该看看 RESTdoclet。 http://ig-group.github.com/RESTdoclet/
You should look at RESTdoclet. http://ig-group.github.com/RESTdoclet/
如果您想自己执行此操作,可以这样处理:
@Path
注释name
属性{customerId}
)映射到对文档目的有意义的内容 - 或许可以通过阅读关联的 Javadoc。注释阅读器不必对现有注释进行任何修改,因此构建端点正则表达式列表应该很简单。结合 Javadocs,您应该能够创建一个有用的工具。我当然会发现它很有用,也许其他人也会。
If you wanted to do this yourself, you could approach it like this:
@Path
annotationsname
attribute{customerId}
) into something meaningful for documentation purposes - perhaps by reading the associated Javadoc.The annotation reader won't have to do any modifications to the existing annotations so it should be straightforward to build up a list of the endpoint regular expressions. In combination with the Javadocs you should be able to create a useful tool. I'd certainly find it useful, and perhaps others would too.
我知道 Enunciate,它与 Jersey/CXF 配合得很好 - 但我不知道是否可以用 SpringMVC 来做。
I know Enunciate, which works pretty well with Jersey/CXF - but I don't know if it does with SpringMVC.