我有一个使用 spring 注释和 Spring MVC 公开 RESTful 操作的应用程序。
看起来像
@RequestMapping(value = "/example/{someId}",
method = RequestMethod.GET, consumes=MediaType.APPLICATION_JSON_VALUE,
produces=MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public void isRegisteredToThread(@PathVariable long someId, HttpServletResponse response) {
[something]
}
我想要的是自动生成的所有 URL、方法和可用参数的列表——可能在 WSDL 中。是否有插件或是否可用?
最佳答案
WSDL 不是为了休息而完成的,它用于 SOAP。
您可能会使用 WADL,但我真的不建议这样做。
在我的项目中,我总是使用 swagger(有一个针对 spring 的版本)。您可以在此处找到更多信息 https://github.com/martypitt/swagger-springmvc在这里 http://blog.zenika.com/index.php?post/2013/07/11/Documenting-a-REST-API-with-Swagger-and-Spring-MVC
试一试。
作为替代方案,如果您不需要基于网络的东西,您可以尝试 rest-shell ( https://github.com/spring-projects/rest-shell )
关于spring - Spring 操作的可用路径列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15570496/