Commit 28b60220f30a49cbd1d9dfa394b34e7971d62f78
1 parent
1b9e8898
提交
Showing
1 changed file
with
22 additions
and
3 deletions
src/main/java/com/zteits/oa/configuration/WebMvcConfig.java
... | ... | @@ -2,6 +2,8 @@ package com.zteits.oa.configuration; |
2 | 2 | |
3 | 3 | import org.springframework.context.annotation.Configuration; |
4 | 4 | import org.springframework.web.servlet.config.annotation.EnableWebMvc; |
5 | +import org.springframework.web.servlet.config.annotation.InterceptorRegistration; | |
6 | +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | |
5 | 7 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
6 | 8 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; |
7 | 9 | |
... | ... | @@ -12,12 +14,29 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter { |
12 | 14 | @Override |
13 | 15 | public void addResourceHandlers(ResourceHandlerRegistry registry) { |
14 | 16 | registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/"); |
15 | - | |
16 | 17 | registry.addResourceHandler("swagger-ui.html") |
17 | 18 | .addResourceLocations("classpath:/META-INF/resources/"); |
18 | - | |
19 | 19 | registry.addResourceHandler("/webjars/**") |
20 | 20 | .addResourceLocations("classpath:/META-INF/resources/webjars/"); |
21 | 21 | |
22 | - } | |
22 | + } | |
23 | + | |
24 | + /** | |
25 | + * 实现登陆拦截.<br/> | |
26 | + */ | |
27 | + @Override | |
28 | + public void addInterceptors(InterceptorRegistry registry) { | |
29 | + InterceptorRegistration addInterceptor = null;//registry.addInterceptor(); | |
30 | + | |
31 | + addInterceptor.excludePathPatterns("/error"); | |
32 | + | |
33 | + addInterceptor.excludePathPatterns("/login**"); | |
34 | + | |
35 | + addInterceptor.addPathPatterns("/**"); | |
36 | + | |
37 | + | |
38 | + | |
39 | + } | |
40 | + | |
41 | + | |
23 | 42 | } | ... | ... |