8000 fix: 修改 multi-rabbit 依赖引入顺序,解决加载 bean 问题 · cadecode/uni-boot-cloud@6e94d62 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6e94d62

Browse files
committed
fix: 修改 multi-rabbit 依赖引入顺序,解决加载 bean 问题
1 parent c73304e commit 6e94d62

File tree

2 files changed

+5
-23
lines changed

2 files changed

+5
-23
lines changed

common/plugin/mq/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
<artifactId>uni-boot-common-plugin-mq</artifactId>
1313

1414
<dependencies>
15-
<!--rabbit-->
16-
<dependency>
17-
<groupId>org.springframework.boot</groupId>
18-
<artifactId>spring-boot-starter-amqp</artifactId>
19-
</dependency>
2015
<!--rabbit 多数据源-->
2116
<dependency>
2217
<groupId>com.free-now.multirabbit</groupId>
2318
<artifactId>spring-multirabbit</artifactId>
2419
</dependency>
20+
<!--rabbit-->
21+
<dependency>
22+
<groupId>org.springframework.boot</groupId>
23+
<artifactId>spring-boot-starter-amqp</artifactId>
24+
</dependency>
2525

2626
<dependency>
2727
<groupId>com.github.cadecode</groupId>

common/plugin/mq/src/main/java/com/github/cadecode/uniboot/common/plugin/mq/config/RabbitAutoConfig.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import org.springframework.amqp.support.converter.MessageConverter;
1515
import org.springframework.beans.factory.InitializingBean;
1616
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
17-
import org.springframework.beans.factory.config.BeanPostProcessor;
1817
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
1918
import org.springframework.boot.autoconfigure.amqp.AbstractRabbitListenerContainerFactoryConfigurer;
2019
import org.springframework.boot.autoconfigure.amqp.MultiRabbitConstants;
@@ -28,7 +27,6 @@
2827
import org.springframework.context.EnvironmentAware;
2928
import org.springframework.context.annotation.Bean;
3029
import org.springframework.context.annotation.Configuration;
31-
import org.springframework.context.annotation.DependsOn;
3230
import org.springframework.core.env.Environment;
3331

3432
import java.util.Map;
@@ -58,12 +56,6 @@ public MultiRabbitDeclareBeanFactoryPostProcessor multiRabbitDeclareBeanFactoryP
5856
return new MultiRabbitDeclareBeanFactoryPostProcessor();
5957
}
6058

61-
@DependsOn(MultiRabbitConstants.CONNECTION_FACTORY_BEAN_NAME)
62-
@Bean
63-
public MultiRabbitContainerBeanPostProcessor multiRabbitContainerBeanPostProcessor() {
64-
return new MultiRabbitContainerBeanPostProcessor();
65-
}
66-
6759
/**
6860
* RabbitMQ ContainerFactory 配置
6961
* 提供对 MultiRabbit 支持
@@ -193,14 +185,4 @@ public String getAdm 7F58 inBeanName(String connectionName) {
193185
return connectionName + MultiRabbitConstants.RABBIT_ADMIN_SUFFIX;
194186
}
195187
}
196-
197-
/**
198-
* spring-multirabbit
199-
* RabbitListener 注解指定 containerFactory 时,由于 multiRabbitConnectionFactory 未加载
200-
* 导致 getBean 获取对应 RabbitAdmin 实例失败
201-
* 此处使用 @DependsOn 使 multiRabbitConnectionFactory 提前加载
202-
*/
203-
public static class MultiRabbitContainerBeanPostProcessor implements BeanPostProcessor {
204-
205-
}
206188
}

0 commit comments

Comments
 (0)
0