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.
我担心传递给 LocaleChangeInterceptor.preHandle() 的参数(对象处理程序)。
当我调用 preHandle() 时,我可以传递当前请求、响应对象。但是我从哪里得到处理程序。
有什么建议么?
通常,handlerSpring 命名法中的 a 指的@Controller是处理当前请求的实现实例。
handler
@Controller
在 的情况下LocaleChangeInterceptor,不使用处理程序参数,因此您可以传递任何内容。但是,如果可能,您应该传递控制器实例以遵守约定。
LocaleChangeInterceptor
编辑:你为什么首先调用它?它应该使用有一个拦截器,并且只能由 Spring MVC 框架调用。