Explorar el Código

增加拦截器顺序

lixing hace 4 años
padre
commit
1dc5faaad3

+ 2 - 0
fm-common/src/main/java/com/persagy/fm/common/config/CommonWebConfigurer.java

@@ -3,6 +3,7 @@ package com.persagy.fm.common.config;
 import com.persagy.fm.common.handler.AppContextHandler;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.core.annotation.Order;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
@@ -14,6 +15,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  * @version: V1.0
  **/
 @Configuration
+@Order(1)
 public class CommonWebConfigurer implements WebMvcConfigurer {
 
     @Bean

+ 1 - 1
fm-common/src/main/java/com/persagy/fm/common/handler/AppContextHandler.java

@@ -30,7 +30,7 @@ public class AppContextHandler extends HandlerInterceptorAdapter {
         if (StringUtils.containsAny(requestURI, IGNORE_URL)) {
             return true;
         }
-//        ensureContextInfo(request.getHeader("token"));
+        ensureContextInfo(request.getHeader("token"));
         return true;
     }
 

+ 2 - 0
fm-mybatis/src/main/java/com/persagy/fm/mybatis/config/MyBatisWebConfigurer.java

@@ -3,6 +3,7 @@ package com.persagy.fm.mybatis.config;
 import com.persagy.fm.mybatis.handler.DynamicDataSourceHandler;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.core.annotation.Order;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
@@ -12,6 +13,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  * @date 2021-03-29
  */
 @Configuration
+@Order(2)
 public class MyBatisWebConfigurer implements WebMvcConfigurer {
 
     @Bean