我使用自动配置其自己的RabbitMQ客户端的公司Spring Boot扩展。这个扩展(起动器)取代了Spring Boot RabbitAutoConfiguration。SpringBoot在启动时定义的多个自动配置排除项
我知道有很多方法来禁用RabbitAutoConfiguration:
- 在与@EnableAutoConfiguration每个应用(主)类(不包括= RabbitAutoConfiguration.class)或@SpringBootApplication(排除= RabbitAutoConfiguration.class)
- 在application.properties或YML文件(外在或罐子内),与spring.autoconfigure.exclude = org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration
我不知道是否有一种方式,我的新起动器存在禁用Spring Boot RabbitAutoConfiguration。
我尝试了一些肮脏的东西,例如在公司启动模块中放置一个application.properties与exclude属性,但由于Spring Boot只在类路径中读取一个,所以它可以很容易地被客户端应用程序中的一个覆盖。我不想强加一些限制。
我不喜欢每个应用程序添加相同的排除方式(属性或注释)的想法。
任何想法?
编辑
我需要在同一应用中配置多个RabbitMQ的ConnectionFactory
和RestTemplate
。
如果您手动配置兔子,自动配置将自动退出...无需排除它。 –
@ M.Deinum这不是我得到的行为,因为配置中有两个RabbitTemplate。 RabbitAutoConfiguration不适用于多个。 –
配置上有很多'@CnditionalOnMissingBean'注释。所以如果你已经添加了一个'RabbitTemplate'和'Connection',配置不应该做任何事情。 –