|
@ -5,8 +5,11 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.yihu.wlyy.interceptors.DoctorInterceptor;
|
|
import com.yihu.wlyy.interceptors.DoctorInterceptor;
|
|
import com.yihu.wlyy.interceptors.PatientInterceptor;
|
|
import com.yihu.wlyy.interceptors.PatientInterceptor;
|
|
import com.yihu.wlyy.interceptors.UserInterceptor;
|
|
import com.yihu.wlyy.interceptors.UserInterceptor;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Profile;
|
|
import org.springframework.http.converter.HttpMessageConverter;
|
|
import org.springframework.http.converter.HttpMessageConverter;
|
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
@ -18,7 +21,10 @@ import java.util.List;
|
|
* Created by chenweida on 2017/4/6.
|
|
* Created by chenweida on 2017/4/6.
|
|
*/
|
|
*/
|
|
@Configuration
|
|
@Configuration
|
|
|
|
@Profile({"test", "prod"})
|
|
public class MvcConfig extends WebMvcConfigurerAdapter {
|
|
public class MvcConfig extends WebMvcConfigurerAdapter {
|
|
|
|
|
|
|
|
private Logger logger = LoggerFactory.getLogger(MvcConfig.class);
|
|
@Autowired
|
|
@Autowired
|
|
private DoctorInterceptor doctorInterceptor;
|
|
private DoctorInterceptor doctorInterceptor;
|
|
@Autowired
|
|
@Autowired
|
|
@ -31,11 +37,12 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
|
|
// 多个拦截器组成一个拦截器链
|
|
// 多个拦截器组成一个拦截器链
|
|
// addPathPatterns 用于添加拦截规则
|
|
// addPathPatterns 用于添加拦截规则
|
|
// excludePathPatterns 用户排除拦截
|
|
// excludePathPatterns 用户排除拦截
|
|
// registry.addInterceptor(doctorInterceptor).addPathPatterns("/doctor/**","/statistics/province/**","/statistics/**");
|
|
|
|
// registry.addInterceptor(patientInterceptor).addPathPatterns("/patient/**");
|
|
|
|
// registry.addInterceptor(userInterceptor).addPathPatterns("/user/**");
|
|
|
|
super.addInterceptors(registry);
|
|
|
|
|
|
registry.addInterceptor(doctorInterceptor).addPathPatterns("/doctor/**", "/statistics/province/**", "/statistics/**");
|
|
|
|
registry.addInterceptor(patientInterceptor).addPathPatterns("/patient/**");
|
|
|
|
registry.addInterceptor(userInterceptor).addPathPatterns("/user/**");
|
|
|
|
|
|
|
|
super.addInterceptors(registry);
|
|
|
|
logger.info("初始化拦截器");
|
|
}
|
|
}
|
|
// /**
|
|
// /**
|
|
// * 为null的数据不返回
|
|
// * 为null的数据不返回
|