mvc:annotation-driven 和 DefaultAnnotationHandlerMapping 配置的问题

mvc:annotation-driven  DefaultAnnotationHandlerMapping  结合配置时,会导致 Interceptor 不起作用:

  

mvc:annotation-driven  会自动注册DefaultAnnotationHandlerMapping和AnnotationMethodHandlerAdapter两个实例 

这个时候启动的 DefaultAnnotationHandlerMapping 没有起作用,仅在自定义配置的 DefaultAnnotationHandlerMapping才起了作用。

而controller 的代码,恰恰是使用了 第一次启动的 DefaultAnnotationHandlerMapping,导致自定义的 Interceptor 不起作用。

使用 mvc:annotation-driven 时的配置:

  

猜你喜欢

转载自www.cnblogs.com/damong/p/11994328.html
今日推荐