|
@@ -1,14 +1,26 @@
|
|
|
package ieven.server.webapp.config;
|
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
|
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
|
|
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
|
|
@Configuration
|
|
|
-public class WebMvcConfig extends WebMvcConfigurationSupport {
|
|
|
+public class WebMvcConfig implements WebMvcConfigurer {
|
|
|
+ @Autowired LoginInterceptor loginInterceptor;
|
|
|
+
|
|
|
// 设置静态资源映射
|
|
|
@Override
|
|
|
- protected void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
|
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
|
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void addInterceptors(InterceptorRegistry registry) {
|
|
|
+ registry
|
|
|
+ .addInterceptor(loginInterceptor)
|
|
|
+ .addPathPatterns("/**")
|
|
|
+ .excludePathPatterns("/", "/user/login");
|
|
|
+ }
|
|
|
}
|