fix(tenant): 按需注册多租户 Job 切面

缺少 xxl-job-core 时跳过 TenantJobAspect 配置,避免未引入
yudao-spring-boot-starter-job 的模块启动时报 NoClassDefFoundError。

Closes https://gitee.com/zhijiantianya/yudao-cloud/issues/IJTOFS
master
YunaiV 2026-06-13 23:53:49 +08:00
parent c769627aaa
commit bf35900a25
1 changed files with 14 additions and 7 deletions

View File

@ -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);
}
}
}