Skip to content

Commit

Permalink
config AccessInterceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
liudaze committed Dec 5, 2018
1 parent 1ff919d commit a1c90d0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/com/geekq/miaosha/config/WebConfig.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(userArgumentResolver);
Expand Down

0 comments on commit a1c90d0

Please sign in to comment.