bugfix:解决 Redis MQ 消息队列的类加载初始化问题
parent
91832e2ae3
commit
95d5fc4a58
|
@ -25,6 +25,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.data.redis.cache.BatchStrategies;
|
import org.springframework.data.redis.cache.BatchStrategies;
|
||||||
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
||||||
|
@ -98,9 +99,20 @@ public class YudaoTenantAutoConfiguration {
|
||||||
|
|
||||||
// ========== MQ ==========
|
// ========== MQ ==========
|
||||||
|
|
||||||
@Bean
|
/**
|
||||||
public TenantRedisMessageInterceptor tenantRedisMessageInterceptor() {
|
* 多租户 Redis 消息队列的配置类
|
||||||
return new TenantRedisMessageInterceptor();
|
*
|
||||||
|
* 为什么要单独一个配置类呢?如果直接把 TenantRedisMessageInterceptor Bean 的初始化放外面,会报 RedisMessageInterceptor 类不存在的错误
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ConditionalOnClass(name = "cn.iocoder.yudao.framework.mq.redis.core.RedisMQTemplate")
|
||||||
|
public static class TenantRedisMQAutoConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public TenantRedisMessageInterceptor tenantRedisMessageInterceptor() {
|
||||||
|
return new TenantRedisMessageInterceptor();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
Loading…
Reference in New Issue