java Spring MVC @Controller 方法签名
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12696222/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Spring MVC @Controller method signatures
提问by Glide
Is there an easy way to view all the possible method signature when I create a controller by annotating a class with @Controller
?
当我通过用 注释一个类来创建一个控制器时,有没有一种简单的方法来查看所有可能的方法签名@Controller
?
I can't find a spring documentation that lists all of that. From their guide, it seems to be reallyflexible where I don't know what I can be returning or what I could use in the method parameters.
我找不到列出所有这些的 spring 文档。从他们的指南来看,它似乎非常灵活,我不知道我可以返回什么或我可以在方法参数中使用什么。
回答by Jerome Dalbert
You should check the Spring MVC reference documentationagain. In the "Defining @RequestMapping handler methods" chapter, everything is listed and explained :
您应该再次查看Spring MVC 参考文档。在“定义@RequestMapping 处理程序方法”一章中,列出并解释了所有内容:
- all the possible parameters
- all the possible return types
- all the possible method/parameter annotations, each one having its sub-chapter : @RequestParam, @RequestBody, @ResponseBody, @ModelAttribute, etc.