有没有一种方法可以检索有关@Controller定义的spring映射的信息? [英] Is there a way to retrieve information about spring mappings defined by @Controller?
问题描述
我希望能够创建一个页面,列出列出用@Controller
注释的控制器发现的映射.我这样做是为了让REST服务可以轻松地在页面上找到实例的可用端点.
I'd like to be able to create a page that lists off the mappings that were discovered by controllers annotated with @Controller
. I'm doing this for REST services that allows us to easily find the endpoints available to the instance on a page.
到目前为止,我一直在手动执行此操作,但是,如果可以创建一个很好地将其发布为令人愉快的格式的控制器,那将是非常有益的.
So far I've manually been doing this, though if it's possible to create a controller that publishes this in a pleasant format nicely it would be greatly beneficial.
我需要的关键信息是
- 端点URI
- 方法(
GET|POST|DELETE|...
) - Params
- 标题
- Endpoint URI
- Method (
GET|POST|DELETE|...
) - Params
- Headers
在我可以创建JSP视图的地方访问这些信息将是理想的选择.
Having access to this information where I could create a JSP view would be ideal.
推荐答案
在Spring 3.1中,有一个称为端点文档"的新功能.我唯一能找到的是 spring-mvc-31-demo示例应用程序中的一些代码.请参考示例控制器和
With Spring 3.1, there is a new feature referred to as "end point documentation". The only thing I could find was some code in the spring-mvc-31-demo sample app. Refer to the example controller and JSP. Seems pretty straight forward.
这篇关于有没有一种方法可以检索有关@Controller定义的spring映射的信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!