springmvc的controller如何实现一个方法可以以多个方式请求(get,post)?
谢过。
为什么要这样实现呢?我感觉好像没有必要。
RequestMapping
这个注解里面method属性声明是一个数组
RequestMethod[] method() default {};
写的时候按数组的语法写就可以了
@RequestMapping(value = "/test", method = {RequestMethod.GET, RequestMethod.POST})