You can not select more than 25 topics
Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- package com.xkcoding.session.config;
-
- import com.xkcoding.session.interceptor.SessionInterceptor;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
- import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
- import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
- /**
- * <p>
- * WebMvc 配置类
- * </p>
- *
- * @package: com.xkcoding.session.config
- * @description: WebMvc 配置类
- * @author: yangkai.shen
- * @date: Created in 2018-12-19 19:50
- * @copyright: Copyright (c) 2018
- * @version: V1.0
- * @modified: yangkai.shen
- */
- @Configuration
- public class WebMvcConfig implements WebMvcConfigurer {
- @Autowired
- private SessionInterceptor sessionInterceptor;
-
- @Override
- public void addInterceptors(InterceptorRegistry registry) {
- InterceptorRegistration sessionInterceptorRegistry = registry.addInterceptor(sessionInterceptor);
- // 排除不需要拦截的路径
- sessionInterceptorRegistry.excludePathPatterns("/page/login");
- sessionInterceptorRegistry.excludePathPatterns("/page/doLogin");
- sessionInterceptorRegistry.excludePathPatterns("/error");
-
- // 需要拦截的路径
- sessionInterceptorRegistry.addPathPatterns("/**");
- }
- }
|