12345678910111213141516171819202122232425262728293031323334 |
- package com.yihu.iot.config;
- import com.yihu.iot.interceptor.GateWayInterceptor;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.context.annotation.Configuration;
- import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
- import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
- /**
- * Created by chenweida on 2017/4/6.
- */
- @Configuration
- public class MvcConfig extends WebMvcConfigurerAdapter {
- private Logger logger = LoggerFactory.getLogger(MvcConfig.class);
- @Autowired
- private GateWayInterceptor gateWayInterceptor;
- @Override
- public void addInterceptors(InterceptorRegistry registry) {
- // 多个拦截器组成一个拦截器链
- // addPathPatterns 用于添加拦截规则
- // excludePathPatterns 用户排除拦截 ,/third/juye/kit/**
- registry.addInterceptor(gateWayInterceptor).addPathPatterns("/svr-iot/open/gc/**").excludePathPatterns(
- "/svr-iot/open/gc/accesstoken",
- "/svr-iot/open/gc/createGcClientDetails");
- super.addInterceptors(registry);
- logger.info("init gateWayInterceptor");
- }
- }
|