miaosha/miaosha-v1/src/main/java/com/geekq/miaosha/config/WebConfig.java

32 lines
985 B
Java
Raw Normal View History

2018-09-15 21:46:13 +08:00
package com.geekq.miaosha.config;
2018-12-05 14:35:14 +08:00
import com.geekq.miaosha.access.AccessInterceptor;
2018-09-15 21:46:13 +08:00
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
2018-12-05 14:35:14 +08:00
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
2018-09-15 21:46:13 +08:00
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import java.util.List;
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
@Autowired
2018-12-08 16:41:34 +08:00
UserArgumentResolver resolver;
2018-09-15 21:46:13 +08:00
2018-12-05 14:35:14 +08:00
@Autowired
2018-12-08 16:41:34 +08:00
private AccessInterceptor interceptor;
2018-12-05 14:35:14 +08:00
@Override
public void addInterceptors(InterceptorRegistry registry) {
super.addInterceptors(registry);
2018-12-08 16:41:34 +08:00
registry.addInterceptor(interceptor);
2018-12-05 14:35:14 +08:00
}
2018-09-15 21:46:13 +08:00
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
2018-12-08 16:41:34 +08:00
argumentResolvers.add(resolver);
2018-09-15 21:46:13 +08:00
}
}