package com.config; import org.springframework.context.annotation.Bean; 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 com.interceptor.AuthorizationInterceptor; @Configuration public class InterceptorConfig extends WebMvcConfigurationSupport{ @Bean public AuthorizationInterceptor getAuthorizationInterceptor() { return new AuthorizationInterceptor(); } @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(getAuthorizationInterceptor()).addPathPatterns("/**").excludePathPatterns("/static/**"); super.addInterceptors(registry); } /** * springboot 2.0配置WebMvcConfigurationSupport之后,会导致默认配置被覆盖,要访问静态资源需要重写addResourceHandlers方法 */ @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/**") .addResourceLocations("classpath:/resources/") .addResourceLocations("classpath:/static/") .addResourceLocations("classpath:/admin/") .addResourceLocations("classpath:/front/") .addResourceLocations("classpath:/public/"); super.addResourceHandlers(registry); } }

luhong LV5
9月17日
15592940706 LV3
6月17日
微信网友_6631309708414976 LV5
2024年12月24日
zolscy LV24
2024年11月24日
15953970869 LV6
2024年11月10日
wuni1105 LV2
2024年10月22日
Peny_ZH LV5
2024年9月22日
微信网友_7044194812350464 LV8
2024年9月13日
yyhrhv LV8
2024年9月3日
lilong007 LV23
2024年8月28日

perfect LV17
昨天
vincemokea LV8
9月22日
dddding yang LV6
9月15日
酷酷的轲 LV10
8月26日
lipanlong LV10
8月21日
ewan007 LV30
7月2日
helloworldsbsb LV8
6月25日
短巷拥猫 LV12
6月23日
limufu LV1
6月17日
462063 LV3
6月16日