带注释的帖子并获得相同的方法

com*_*tta 3 java rest spring

我可以知道是否有可能用2个帖子注释一个方法并得到?

@RequestMapping(value = "/testonly", 
                method = RequestMethod.GET, RequestMethod.POST)
public String getSomething(){

}
Run Code Online (Sandbox Code Playgroud)

Jon*_*eet 24

method字段是一个数组,所以我希望这个工作:

@RequestMapping(value = "/testonly",
                method = { RequestMethod.GET, RequestMethod.POST })
Run Code Online (Sandbox Code Playgroud)