bugfix:解决 Redis MQ 消息队列的类加载初始化问题
This commit is contained in:
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,11 +99,22 @@ public class YudaoTenantAutoConfiguration {
|
|||||||
|
|
||||||
// ========== MQ ==========
|
// ========== MQ ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多租户 Redis 消息队列的配置类
|
||||||
|
*
|
||||||
|
* 为什么要单独一个配置类呢?如果直接把 TenantRedisMessageInterceptor Bean 的初始化放外面,会报 RedisMessageInterceptor 类不存在的错误
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ConditionalOnClass(name = "cn.iocoder.yudao.framework.mq.redis.core.RedisMQTemplate")
|
||||||
|
public static class TenantRedisMQAutoConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public TenantRedisMessageInterceptor tenantRedisMessageInterceptor() {
|
public TenantRedisMessageInterceptor tenantRedisMessageInterceptor() {
|
||||||
return new TenantRedisMessageInterceptor();
|
return new TenantRedisMessageInterceptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnClass(name = "org.springframework.amqp.rabbit.core.RabbitTemplate")
|
@ConditionalOnClass(name = "org.springframework.amqp.rabbit.core.RabbitTemplate")
|
||||||
public TenantRabbitMQInitializer tenantRabbitMQInitializer() {
|
public TenantRabbitMQInitializer tenantRabbitMQInitializer() {
|
||||||
|
Loading…
Reference in New Issue
Block a user