mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-11 05:19:00 +08:00
fix(data): 延迟初始化数据权限 Feign 客户端
This commit is contained in:
1 parent
d9130d4fbf
commit
41f20b2db3
1 file changed
+5
-1
+5
-1
@@ -42,6 +42,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
||||
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
@@ -118,13 +119,16 @@ public class MybatisPlusConfiguration implements WebMvcConfigurer {
|
||||
|
||||
/**
|
||||
* 数据权限拦截器
|
||||
* <p>
|
||||
* 远程数据权限客户端延迟到首次权限计算时解析,避免 MyBatis 在应用启动期创建
|
||||
* Feign 子上下文,进而与 MVC、安全拦截器等业务扩展形成循环初始化。
|
||||
*
|
||||
* @return DataScopeInterceptor
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnBean(UserContextHolder.class)
|
||||
public DataScopeInterceptor dataScopeInterceptor(RemoteDataScopeService dataScopeService,
|
||||
public DataScopeInterceptor dataScopeInterceptor(@Lazy RemoteDataScopeService dataScopeService,
|
||||
UserContextHolder userContextHolder) {
|
||||
DataScopeInnerInterceptor dataScopeInnerInterceptor = new DataScopeInnerInterceptor();
|
||||
dataScopeInnerInterceptor.setDataScopeHandle(new PigxDefaultDataScopeHandle(dataScopeService, userContextHolder));
|
||||
|
||||
Reference in new issue
Block a user