diff --git a/src/main/java/com/geekq/miaosha/config/WebConfig.java b/src/main/java/com/geekq/miaosha/config/WebConfig.java index 3399845..9518857 100644 --- a/src/main/java/com/geekq/miaosha/config/WebConfig.java +++ b/src/main/java/com/geekq/miaosha/config/WebConfig.java @@ -1,8 +1,10 @@ package com.geekq.miaosha.config; +import com.geekq.miaosha.access.AccessInterceptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.web.method.support.HandlerMethodArgumentResolver; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import java.util.List; @@ -13,6 +15,15 @@ public class WebConfig extends WebMvcConfigurerAdapter { @Autowired UserArgumentResolver userArgumentResolver; + @Autowired + private AccessInterceptor accessInterceptor; + + @Override + public void addInterceptors(InterceptorRegistry registry) { + super.addInterceptors(registry); + registry.addInterceptor(accessInterceptor); + } + @Override public void addArgumentResolvers(List argumentResolvers) { argumentResolvers.add(userArgumentResolver);