Java 仅排除spring引导中的rabbitMqtemplate自动配置

Java 仅排除spring引导中的rabbitMqtemplate自动配置,java,rabbitmq,spring-cloud-config,Java,Rabbitmq,Spring Cloud Config,我已经在SpringCloudConfiguration文件中配置了RabbitMQ @Bean @ConditionalOnProperty(名称={“gssp.amqp.enabled”,“rabbitmq.addresses”},matchIfMissing=false) RabbitTemplate RabbitTemplate(ConnectionFactory ConnectionFactory,MessageConverter jsonMessageConverter){ Rabb

我已经在SpringCloudConfiguration文件中配置了RabbitMQ

@Bean
@ConditionalOnProperty(名称={“gssp.amqp.enabled”,“rabbitmq.addresses”},matchIfMissing=false)
RabbitTemplate RabbitTemplate(ConnectionFactory ConnectionFactory,MessageConverter jsonMessageConverter){
RabbitTemplate=新的RabbitTemplate(connectionFactory);
setMessageConverter(jsonMessageConverter);
template.afterPropertieSet();
返回模板;
}
但当我尝试运行服务器时,它会显示以下异常:

The bean 'rabbitTemplate', defined in class path resource [org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration$RabbitTemplateConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [com/metlife/gssp/spring/configuration/SpringCloudConfiguration.class] and overriding is disabled.
我必须使用属性
“spring.main.allow-bean-definition-overriding:true”
来进行重写。我不想使用这个财产。 是否可以排除此自动配置
RabbitAutoConfiguration$RabbitImplateConfiguration.class

我只想排除RabbitTemplateConfiguration,而不是整个RabbitAutoConfiguration,因为Spring也在配置其他一些bean

注:

我试过这个

`spring.autoconfigure.exclude:org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration1在我的yml文件中,但它也会停止其他bean


我只想停止嵌套类
RabbitAutoConfiguration.rabbitmplateconfiguration
autoconfiguration,只想使用我的SpringCloudConfiguration。

见此。它排除了整个RabbitAutoConfiguration,而不是内部类RabbitImplateConfiguration。有人能帮上忙吗?请看这个。它排除了整个RabbitAutoConfiguration,而不是内部类RabbitImplateConfiguration。有人能帮上忙吗??