|
|
@@ -0,0 +1,36 @@
|
|
|
+package com.mrxu.framework.boot.config;
|
|
|
+
|
|
|
+import com.mrxu.framework.boot.handle.UserInfoHandler;
|
|
|
+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.WebMvcConfigurer;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 功能概要:[mvc配置类] <br>
|
|
|
+ *
|
|
|
+ * @author zzt
|
|
|
+ * @date 2020/10/15
|
|
|
+ */
|
|
|
+@Configuration
|
|
|
+public class WebMvcConfig implements WebMvcConfigurer {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户信息拦截器
|
|
|
+ * @return 用户信息拦截器
|
|
|
+ */
|
|
|
+ @Bean
|
|
|
+ public UserInfoHandler userInfoHandler() {
|
|
|
+ return new UserInfoHandler();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 拦截器添加
|
|
|
+ * @param registry
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void addInterceptors(InterceptorRegistry registry) {
|
|
|
+ registry.addInterceptor(userInfoHandler()).addPathPatterns("/**");
|
|
|
+ WebMvcConfigurer.super.addInterceptors(registry);
|
|
|
+ }
|
|
|
+}
|