2021-03-15更新

This commit is contained in:
TianSH
2021-03-15 10:15:41 +08:00
parent ee52957d31
commit 867bde24be
145 changed files with 14644 additions and 25602 deletions
@@ -2,8 +2,10 @@ package cn.hellohao.controller;
import cn.hellohao.exception.StorageSourceInitException;
import cn.hellohao.utils.Print;
import org.springframework.ui.Model;
import org.springframework.validation.BindException;
import org.springframework.validation.ObjectError;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;
@@ -50,6 +52,20 @@ public class ExceptionHandling {
return e.getMessage();
}
@ExceptionHandler
public String test3(HttpRequestMethodNotSupportedException e,Model model){
ModelAndView modelAndView = new ModelAndView("/index");
Print.Normal("URL访问类型不正确:"+ e.getMessage());
//e.printStackTrace();
modelAndView.addObject("error","URL访问类型不正确。");
model.addAttribute("error","URL访问类型不正确。");
//返回错误信息,并显示给用户
//return e.getMessage();
return "exception";
}
// @ExceptionHandler
// public String methodArgumentNotValid(BindException e) {