DanielGuo
V2EX  ›  问与答

@ControllerAdvice 和 @Aspect 的执行顺序是怎么样的?哪个在前

  •  
  •   DanielGuo · Nov 21, 2019 · 2239 views
    This topic created in 2372 days ago, the information mentioned may be changed or developed.
    还有另外一个问题,Aspect 中抛出了一个异常,被 ControllerAdvice 中的 ExceptionHandler 抓住了,但是 model 里没有在 ControllerAdvice 中使用 @ModelAttribute 绑定的数据。。。。
    这个 model 绑定上 attribute 是在什么时候?难道非要执行到业务方法( requestMapping )时才会往 model 中绑定 attribute 吗?
    我想在 ExceptionHandler 中使用全部 @ModelAttribute 都绑定好的 model
    2 replies    2019-11-27 18:38:01 +08:00
    lt1994
        1
    lt1994  
       Nov 27, 2019
    我现在遇到的问题是,在 @Aspect 抛出的异常,在 @ControllerAdvice+@ExceptionHandler 捕获不到。 @ControllerAdvice 是初始化是成功了
    DanielGuo
        2
    DanielGuo  
    OP
       Nov 27, 2019 via iPhone
    @lt1994 ………………你这个,把 exceptionHandler 注解发上来看看啊
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3493 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 04:47 · PVG 12:47 · LAX 21:47 · JFK 00:47
    ♥ Do have faith in what you're doing.