Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以将 Spring @ExceptionHandler 映射到特定路径?
我需要捕获@Email 验证异常,这在我的控制器方法中没有发生,所以我无法抛出我的异常。
谢谢!
看起来对我来说正确的解决方案是:
public void method(@Valid Object o, BindingResult res){ if(res.hasErrors()){ throw new MyException(); } }