diff --git a/src/main/java/com/common/config/MyInterceptorConfig.java b/src/main/java/com/common/config/MyInterceptorConfig.java new file mode 100644 index 0000000..efc5dc3 --- /dev/null +++ b/src/main/java/com/common/config/MyInterceptorConfig.java @@ -0,0 +1,16 @@ +package com.example.common.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class MyInterceptorConfig implements WebMvcConfigurer { + @Override + public void addInterceptors(InterceptorRegistry registry) { + // 实现WebMvcConfigurer不会导致静态资源被拦截 + registry.addInterceptor(new MyInterceptor()) + .addPathPatterns("/end/page/**") + .excludePathPatterns("/end/page/login.html", "/end/page/register.html"); + } +}