Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Configuration
- @EnableWebMvc
- public class AppContextConfiguration extends WebMvcConfigurerAdapter {
- ...
- @Override
- public void addInterceptors(InterceptorRegistry registry) {
- registry.addInterceptor(new MyInterceptor());
- }
- ...
- }
- public class MyInterceptor extends HandlerInterceptorAdapter{
- private static final Logger logger = LoggerFactory.getLogger(MyInterceptor.class);
- @Override
- public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
- Object handler) throws Exception {
- logger.debug("MyInterceptor - PREHANDLE");
- }
- }
- <mvc:interceptors>
- <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
- </mvc:interceptors>
- <mvc:interceptors>
- <mvc:interceptor>
- <mapping path="/secure/*"/>
- <bean class="org.example.SecurityInterceptor" />
- </mvc:interceptor>
- </mvc:interceptors>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement