|
@@ -1,14 +1,11 @@
|
|
|
package cn.iocoder.yudao.framework.tenant.config;
|
|
|
|
|
|
-import cn.hutool.core.annotation.AnnotationUtil;
|
|
|
import cn.iocoder.yudao.framework.common.enums.WebFilterOrderEnum;
|
|
|
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
|
|
-import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
|
|
import cn.iocoder.yudao.framework.redis.config.YudaoCacheProperties;
|
|
|
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnoreAspect;
|
|
|
import cn.iocoder.yudao.framework.tenant.core.db.TenantDatabaseInterceptor;
|
|
|
-import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
|
|
-import cn.iocoder.yudao.framework.tenant.core.job.TenantJobHandlerDecorator;
|
|
|
+import cn.iocoder.yudao.framework.tenant.core.job.TenantJobAspect;
|
|
|
import cn.iocoder.yudao.framework.tenant.core.mq.TenantRedisMessageInterceptor;
|
|
|
import cn.iocoder.yudao.framework.tenant.core.redis.TenantRedisCacheManager;
|
|
|
import cn.iocoder.yudao.framework.tenant.core.security.TenantSecurityWebFilter;
|
|
@@ -20,8 +17,6 @@ import cn.iocoder.yudao.framework.web.core.handler.GlobalExceptionHandler;
|
|
|
import cn.iocoder.yudao.module.system.api.tenant.TenantApi;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
|
|
|
-import org.springframework.beans.BeansException;
|
|
|
-import org.springframework.beans.factory.config.BeanPostProcessor;
|
|
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
@@ -100,25 +95,8 @@ public class YudaoTenantAutoConfiguration {
|
|
|
// ========== Job ==========
|
|
|
|
|
|
@Bean
|
|
|
- @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
|
|
|
- public BeanPostProcessor jobHandlerBeanPostProcessor(TenantFrameworkService tenantFrameworkService) {
|
|
|
- return new BeanPostProcessor() {
|
|
|
-
|
|
|
- @Override
|
|
|
- public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
|
|
- if (!(bean instanceof JobHandler)) {
|
|
|
- return bean;
|
|
|
- }
|
|
|
- // 有 TenantJob 注解的情况下,才会进行处理
|
|
|
- if (!AnnotationUtil.hasAnnotation(bean.getClass(), TenantJob.class)) {
|
|
|
- return bean;
|
|
|
- }
|
|
|
-
|
|
|
- // 使用 TenantJobHandlerDecorator 装饰
|
|
|
- return new TenantJobHandlerDecorator(tenantFrameworkService, (JobHandler) bean);
|
|
|
- }
|
|
|
-
|
|
|
- };
|
|
|
+ public TenantJobAspect tenantJobAspect(TenantFrameworkService tenantFrameworkService) {
|
|
|
+ return new TenantJobAspect(tenantFrameworkService);
|
|
|
}
|
|
|
|
|
|
// ========== Redis ==========
|