diff --git a/src/main/java/works/weave/socks/cart/configuration/WebMvcConfig.java b/src/main/java/works/weave/socks/cart/configuration/WebMvcConfig.java index a6e7eded8..7eac966a0 100644 --- a/src/main/java/works/weave/socks/cart/configuration/WebMvcConfig.java +++ b/src/main/java/works/weave/socks/cart/configuration/WebMvcConfig.java @@ -1,25 +1,19 @@ package works.weave.socks.cart.configuration; -import org.springframework.beans.factory.annotation.Autowired; 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.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.handler.MappedInterceptor; import works.weave.socks.cart.middleware.HTTPMonitoringInterceptor; @Configuration -public class WebMvcConfig extends WebMvcConfigurerAdapter { - @Autowired - private HTTPMonitoringInterceptor httpMonitoringInterceptor; - +public class WebMvcConfig { @Bean HTTPMonitoringInterceptor httpMonitoringInterceptor() { return new HTTPMonitoringInterceptor(); } - @Override - public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(httpMonitoringInterceptor) - .addPathPatterns("/**"); + @Bean + public MappedInterceptor myMappedInterceptor(HTTPMonitoringInterceptor interceptor) { + return new MappedInterceptor(new String[]{"/**"}, interceptor); } }