fallback Api接口还是使用默认的接口实现
							parent
							
								
									bd706ecfd8
								
							
						
					
					
						commit
						464fd60637
					
				|  | @ -1,6 +1,5 @@ | ||||||
| package cn.iocoder.yudao.framework.tenant.config; | package cn.iocoder.yudao.framework.tenant.config; | ||||||
| 
 | 
 | ||||||
| import cn.hutool.extra.spring.SpringUtil; |  | ||||||
| import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum; | import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum; | ||||||
| import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; | import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; | ||||||
| import cn.iocoder.yudao.framework.redis.config.YudaoCacheProperties; | import cn.iocoder.yudao.framework.redis.config.YudaoCacheProperties; | ||||||
|  | @ -44,13 +43,6 @@ public class YudaoTenantAutoConfiguration { | ||||||
| 
 | 
 | ||||||
|     @Bean |     @Bean | ||||||
|     public TenantFrameworkService tenantFrameworkService(TenantApi tenantApi) { |     public TenantFrameworkService tenantFrameworkService(TenantApi tenantApi) { | ||||||
|         // Cloud 专属逻辑:优先使用本地的 tenantApi 实现类,而不是 Feign 调用
 |  | ||||||
|         try { |  | ||||||
|             TenantApi tenantApiImpl = SpringUtil.getBean("tenantApiImpl", TenantApi.class); |  | ||||||
|             if (tenantApiImpl != null) { |  | ||||||
|                 tenantApi =  tenantApiImpl; |  | ||||||
|             } |  | ||||||
|         } catch (Exception ignored) {} |  | ||||||
|         return new TenantFrameworkServiceImpl(tenantApi); |         return new TenantFrameworkServiceImpl(tenantApi); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,6 +1,5 @@ | ||||||
| package cn.iocoder.yudao.framework.dict.config; | package cn.iocoder.yudao.framework.dict.config; | ||||||
| 
 | 
 | ||||||
| import cn.hutool.extra.spring.SpringUtil; |  | ||||||
| import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; | import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; | ||||||
| import cn.iocoder.yudao.module.system.api.dict.DictDataApi; | import cn.iocoder.yudao.module.system.api.dict.DictDataApi; | ||||||
| import org.springframework.boot.autoconfigure.AutoConfiguration; | import org.springframework.boot.autoconfigure.AutoConfiguration; | ||||||
|  | @ -12,13 +11,6 @@ public class YudaoDictAutoConfiguration { | ||||||
|     @Bean |     @Bean | ||||||
|     @SuppressWarnings("InstantiationOfUtilityClass") |     @SuppressWarnings("InstantiationOfUtilityClass") | ||||||
|     public DictFrameworkUtils dictUtils(DictDataApi dictDataApi) { |     public DictFrameworkUtils dictUtils(DictDataApi dictDataApi) { | ||||||
|         // Cloud 专属逻辑:优先使用本地的 dictDataApiImpl 实现类,而不是 Feign 调用
 |  | ||||||
|         try { |  | ||||||
|             DictDataApi apiImpl = SpringUtil.getBean("dictDataApiImpl", DictDataApi.class); |  | ||||||
|             if (apiImpl != null) { |  | ||||||
|                 dictDataApi =  apiImpl; |  | ||||||
|             } |  | ||||||
|         } catch (Exception ignored) {} |  | ||||||
|         DictFrameworkUtils.init(dictDataApi); |         DictFrameworkUtils.init(dictDataApi); | ||||||
|         return new DictFrameworkUtils(); |         return new DictFrameworkUtils(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -25,11 +25,19 @@ import java.util.concurrent.TimeUnit; | ||||||
|  * |  * | ||||||
|  * @author 芋道源码 |  * @author 芋道源码 | ||||||
|  */ |  */ | ||||||
| @AutoConfiguration(before = MybatisPlusAutoConfiguration.class) // 目的:先于 MyBatis Plus 自动配置,避免 @MapperScan 可能扫描不到 Mapper 打印 warn 日志
 | @AutoConfiguration(before = MybatisPlusAutoConfiguration.class) | ||||||
|  | // 目的:先于 MyBatis Plus 自动配置,避免 @MapperScan 可能扫描不到 Mapper 打印 warn 日志
 | ||||||
| @MapperScan(value = "${yudao.info.base-package}", annotationClass = Mapper.class, | @MapperScan(value = "${yudao.info.base-package}", annotationClass = Mapper.class, | ||||||
|         lazyInitialization = "${mybatis.lazy-initialization:false}") // Mapper 懒加载,目前仅用于单元测试
 |         lazyInitialization = "${mybatis.lazy-initialization:false}") // Mapper 懒加载,目前仅用于单元测试
 | ||||||
| public class YudaoMybatisAutoConfiguration { | public class YudaoMybatisAutoConfiguration { | ||||||
| 
 | 
 | ||||||
|  |     static { | ||||||
|  |         JsqlParserGlobal.setJsqlParseCache(new JdkSerialCaffeineJsqlParseCache( | ||||||
|  |                 (cache) -> cache.maximumSize(1024) | ||||||
|  |                         .expireAfterWrite(5, TimeUnit.SECONDS)) | ||||||
|  |         ); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     @Bean |     @Bean | ||||||
|     public MybatisPlusInterceptor mybatisPlusInterceptor() { |     public MybatisPlusInterceptor mybatisPlusInterceptor() { | ||||||
|         MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor(); |         MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor(); | ||||||
|  | @ -38,7 +46,7 @@ public class YudaoMybatisAutoConfiguration { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Bean |     @Bean | ||||||
|     public MetaObjectHandler defaultMetaObjectHandler(){ |     public MetaObjectHandler defaultMetaObjectHandler() { | ||||||
|         return new DefaultDBFieldHandler(); // 自动填充参数类
 |         return new DefaultDBFieldHandler(); // 自动填充参数类
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -65,10 +73,5 @@ public class YudaoMybatisAutoConfiguration { | ||||||
|         throw new IllegalArgumentException(StrUtil.format("DbType{} 找不到合适的 IKeyGenerator 实现类", dbType)); |         throw new IllegalArgumentException(StrUtil.format("DbType{} 找不到合适的 IKeyGenerator 实现类", dbType)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     static { | 
 | ||||||
|         JsqlParserGlobal.setJsqlParseCache(new JdkSerialCaffeineJsqlParseCache( |  | ||||||
|                 (cache) -> cache.maximumSize(1024) |  | ||||||
|                         .expireAfterWrite(5, TimeUnit.SECONDS)) |  | ||||||
|         ); |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,10 +1,6 @@ | ||||||
| package cn.iocoder.yudao.framework.operatelog.config; | package cn.iocoder.yudao.framework.operatelog.config; | ||||||
| 
 | 
 | ||||||
| import cn.hutool.extra.spring.SpringUtil; |  | ||||||
| import cn.iocoder.yudao.framework.operatelog.core.service.LogRecordServiceImpl; | import cn.iocoder.yudao.framework.operatelog.core.service.LogRecordServiceImpl; | ||||||
| import cn.iocoder.yudao.framework.operatelog.core.service.OperateLogFrameworkService; |  | ||||||
| import cn.iocoder.yudao.framework.operatelog.core.service.OperateLogFrameworkServiceImpl; |  | ||||||
| import cn.iocoder.yudao.module.system.api.logger.OperateLogApi; |  | ||||||
| import com.mzt.logapi.service.ILogRecordService; | import com.mzt.logapi.service.ILogRecordService; | ||||||
| import com.mzt.logapi.starter.annotation.EnableLogRecord; | import com.mzt.logapi.starter.annotation.EnableLogRecord; | ||||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||||
|  | @ -28,16 +24,4 @@ public class YudaoOperateLogConfiguration { | ||||||
|         return new LogRecordServiceImpl(); |         return new LogRecordServiceImpl(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Bean |  | ||||||
|     public OperateLogFrameworkService operateLogFrameworkServiceImpl(OperateLogApi operateLogApi) { |  | ||||||
|         // Cloud 专属逻辑:优先使用本地的 operateLogApi 实现类,而不是 Feign 调用
 |  | ||||||
|         try { |  | ||||||
|             OperateLogApi operateLogApiImpl = SpringUtil.getBean("operateLogApiImpl", OperateLogApi.class); |  | ||||||
|             if (operateLogApiImpl != null) { |  | ||||||
|                 operateLogApi =  operateLogApiImpl; |  | ||||||
|             } |  | ||||||
|         } catch (Exception ignored) {} |  | ||||||
|         return new OperateLogFrameworkServiceImpl(operateLogApi); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,6 +1,5 @@ | ||||||
| package cn.iocoder.yudao.framework.security.config; | package cn.iocoder.yudao.framework.security.config; | ||||||
| 
 | 
 | ||||||
| import cn.hutool.extra.spring.SpringUtil; |  | ||||||
| import cn.iocoder.yudao.framework.security.core.aop.PreAuthenticatedAspect; | import cn.iocoder.yudao.framework.security.core.aop.PreAuthenticatedAspect; | ||||||
| import cn.iocoder.yudao.framework.security.core.context.TransmittableThreadLocalSecurityContextHolderStrategy; | import cn.iocoder.yudao.framework.security.core.context.TransmittableThreadLocalSecurityContextHolderStrategy; | ||||||
| import cn.iocoder.yudao.framework.security.core.filter.TokenAuthenticationFilter; | import cn.iocoder.yudao.framework.security.core.filter.TokenAuthenticationFilter; | ||||||
|  | @ -80,27 +79,11 @@ public class YudaoSecurityAutoConfiguration { | ||||||
|     @Bean |     @Bean | ||||||
|     public TokenAuthenticationFilter authenticationTokenFilter(GlobalExceptionHandler globalExceptionHandler, |     public TokenAuthenticationFilter authenticationTokenFilter(GlobalExceptionHandler globalExceptionHandler, | ||||||
|                                                                OAuth2TokenApi oauth2TokenApi) { |                                                                OAuth2TokenApi oauth2TokenApi) { | ||||||
|         // Cloud 专属逻辑:优先使用本地的 oauth2TokenApi 实现类,而不是 Feign 调用
 |  | ||||||
|         try { |  | ||||||
|             OAuth2TokenApi oAuth2TokenApiImpl = SpringUtil.getBean("OAuth2TokenApiImpl", OAuth2TokenApi.class); |  | ||||||
|             if (oAuth2TokenApiImpl != null) { |  | ||||||
|                 oauth2TokenApi = oAuth2TokenApiImpl; |  | ||||||
|             } |  | ||||||
|         } catch (Exception ignored) { |  | ||||||
|         } |  | ||||||
|         return new TokenAuthenticationFilter(securityProperties, globalExceptionHandler, oauth2TokenApi); |         return new TokenAuthenticationFilter(securityProperties, globalExceptionHandler, oauth2TokenApi); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Bean("ss") // 使用 Spring Security 的缩写,方便使用
 |     @Bean("ss") // 使用 Spring Security 的缩写,方便使用
 | ||||||
|     public SecurityFrameworkService securityFrameworkService(PermissionApi permissionApi) { |     public SecurityFrameworkService securityFrameworkService(PermissionApi permissionApi) { | ||||||
|         // Cloud 专属逻辑:优先使用本地的 permissionApi 实现类,而不是 Feign 调用
 |  | ||||||
|         try { |  | ||||||
|             PermissionApi permissionApiImpl = SpringUtil.getBean("permissionApiImpl", PermissionApi.class); |  | ||||||
|             if (permissionApiImpl != null) { |  | ||||||
|                 permissionApi = permissionApiImpl; |  | ||||||
|             } |  | ||||||
|         } catch (Exception ignored) { |  | ||||||
|         } |  | ||||||
|         return new SecurityFrameworkServiceImpl(permissionApi); |         return new SecurityFrameworkServiceImpl(permissionApi); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,6 +1,5 @@ | ||||||
| package cn.iocoder.yudao.framework.apilog.config; | package cn.iocoder.yudao.framework.apilog.config; | ||||||
| 
 | 
 | ||||||
| import cn.hutool.extra.spring.SpringUtil; |  | ||||||
| import cn.iocoder.yudao.framework.apilog.core.filter.ApiAccessLogFilter; | import cn.iocoder.yudao.framework.apilog.core.filter.ApiAccessLogFilter; | ||||||
| import cn.iocoder.yudao.framework.apilog.core.interceptor.ApiAccessLogInterceptor; | import cn.iocoder.yudao.framework.apilog.core.interceptor.ApiAccessLogInterceptor; | ||||||
| import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkService; | import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkService; | ||||||
|  | @ -27,26 +26,12 @@ public class YudaoApiLogAutoConfiguration implements WebMvcConfigurer { | ||||||
|     @Bean |     @Bean | ||||||
|     @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") |     @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") | ||||||
|     public ApiAccessLogFrameworkService apiAccessLogFrameworkService(ApiAccessLogApi apiAccessLogApi) { |     public ApiAccessLogFrameworkService apiAccessLogFrameworkService(ApiAccessLogApi apiAccessLogApi) { | ||||||
|         // Cloud 专属逻辑:优先使用本地的 apiAccessLogApiImpl 实现类,而不是 Feign 调用
 |  | ||||||
|         try { |  | ||||||
|             ApiAccessLogApi apiImpl = SpringUtil.getBean("apiAccessLogApiImpl", ApiAccessLogApi.class); |  | ||||||
|             if (apiImpl != null) { |  | ||||||
|                 apiAccessLogApi =  apiImpl; |  | ||||||
|             } |  | ||||||
|         } catch (Exception ignored) {} |  | ||||||
|         return new ApiAccessLogFrameworkServiceImpl(apiAccessLogApi); |         return new ApiAccessLogFrameworkServiceImpl(apiAccessLogApi); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Bean |     @Bean | ||||||
|     @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") |     @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") | ||||||
|     public ApiErrorLogFrameworkService apiErrorLogFrameworkService(ApiErrorLogApi apiErrorLogApi) { |     public ApiErrorLogFrameworkService apiErrorLogFrameworkService(ApiErrorLogApi apiErrorLogApi) { | ||||||
|         // Cloud 专属逻辑:优先使用本地的 apiErrorLogApiImpl 实现类,而不是 Feign 调用
 |  | ||||||
|         try { |  | ||||||
|             ApiErrorLogApi apiImpl = SpringUtil.getBean("apiErrorLogApiImpl", ApiErrorLogApi.class); |  | ||||||
|             if (apiImpl != null) { |  | ||||||
|                 apiErrorLogApi =  apiImpl; |  | ||||||
|             } |  | ||||||
|         } catch (Exception ignored) {} |  | ||||||
|         return new ApiErrorLogFrameworkServiceImpl(apiErrorLogApi); |         return new ApiErrorLogFrameworkServiceImpl(apiErrorLogApi); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 1351515658@qq.com
						1351515658@qq.com