spring 使用@Valid校验数据出错DEBUG org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod - Failed to resolve argument 0 of type

匿名 (未验证) 提交于 2019-12-03 00:02:01

@ValidBindingResult

参考来源:https://segmentfault.com/q/1010000008384686

正确的参数签名

    @PostMapping("publishPost.do")     public String publishPost(@Valid @ModelAttribute Post post,                               BindingResult bindingResult,                               Errors errors, Model model, Integer tid,String action, RedirectAttributes attributes) {

错误的签名

//发帖     @PostMapping("publishPost.do")     public String publishPost(@Valid @ModelAttribute Post post,Integer tid,                               BindingResult bindingResult,                               Errors errors, Model model, String action, RedirectAttributes attributes) {

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!