|
|
@@ -1,27 +0,0 @@
|
|
1
|
|
-package com;
|
|
2
|
|
-
|
|
3
|
|
-import org.springframework.context.annotation.Bean;
|
|
4
|
|
-import org.springframework.context.annotation.Configuration;
|
|
5
|
|
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
6
|
|
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
|
7
|
|
-
|
|
8
|
|
-//@Configuration
|
|
9
|
|
-public class InterceptorConfig extends WebMvcConfigurationSupport {
|
|
10
|
|
-
|
|
11
|
|
- @Bean
|
|
12
|
|
- public LogercostInterceptor getInterceptor() {
|
|
13
|
|
- return new LogercostInterceptor();
|
|
14
|
|
- }
|
|
15
|
|
- /**
|
|
16
|
|
- * interceptor配置
|
|
17
|
|
- */
|
|
18
|
|
- @Override
|
|
19
|
|
- public void addInterceptors(InterceptorRegistry registry) {
|
|
20
|
|
-
|
|
21
|
|
- //添加需要验证登录用户操作权限的请求
|
|
22
|
|
- registry.addInterceptor(getInterceptor()).addPathPatterns("/**");
|
|
23
|
|
-
|
|
24
|
|
- //这里可以用registry.addInterceptor添加多个拦截器实例,后面加上匹配模式
|
|
25
|
|
- //super.addInterceptors(registry);//最后将register往这里塞进去就可以了
|
|
26
|
|
- }
|
|
27
|
|
-}
|