From bf35900a250fb8211d5402d9db613755b5aa4e27 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 13 Jun 2026 23:53:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(tenant):=20=E6=8C=89=E9=9C=80=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E5=A4=9A=E7=A7=9F=E6=88=B7=20Job=20=E5=88=87=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 缺少 xxl-job-core 时跳过 TenantJobAspect 配置,避免未引入 yudao-spring-boot-starter-job 的模块启动时报 NoClassDefFoundError。 Closes https://gitee.com/zhijiantianya/yudao-cloud/issues/IJTOFS --- .../config/YudaoTenantAutoConfiguration.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java index 485e1aa7d..b0ead6910 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java @@ -30,6 +30,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.data.redis.cache.BatchStrategies; import org.springframework.data.redis.cache.RedisCacheConfiguration; @@ -172,13 +173,6 @@ public class YudaoTenantAutoConfiguration { return new TenantRocketMQInitializer(); } - // ========== Job ========== - - @Bean - public TenantJobAspect tenantJobAspect(TenantFrameworkService tenantFrameworkService) { - return new TenantJobAspect(tenantFrameworkService); - } - // ========== Redis ========== @Bean @@ -200,4 +194,17 @@ public class YudaoTenantAutoConfiguration { return cacheManager; } + // ========== Job ========== + + @Configuration(proxyBeanMethods = false) + @ConditionalOnClass(name = "com.xxl.job.core.context.XxlJobContext") + public static class TenantJobConfiguration { + + @Bean + public TenantJobAspect tenantJobAspect(TenantFrameworkService tenantFrameworkService) { + return new TenantJobAspect(tenantFrameworkService); + } + + } + }