Disable RabbitTemplate bean creation via configuration
See original GitHub issueRelated to #3587 and possibly to spring.rabbitmq.dynamic=false.
I’d like to run tests that must not use the local RabbitMQ server. The autoconfiguration creates a RabbitTemplate bean which automatically connects to my local RabbitMQ server and, when used, sends messages into the system.
I tried setting spring.rabbitmq.listener.auto-startup=false (see #3587), but this does not help. Setting spring.rabbitmq.host= does not seem to do anything, and any (other) invalid option causes a timeout.
A workaround is to create a (mock) bean of type RabbitTemplate. However, this would be my only explicit reference to RabbitMQ from my code, as I’m using AMQP interfaces everywhere.
Could you please add an option to disable RabbitMQ/RabbitTemplate via configuration?
I can already disable AmqpTemplate autocreation using spring.rabbitmq.dynamic=false. Similarly (with better names imho), I can already disable Eureka (eureka.client.enabled=false) and Spring Cloud Bus (spring.cloud.bus.enabled=false).
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (5 by maintainers)
Top Related StackOverflow Question
We already have such an option. You can disable any auto-configuration class using the
spring.autoconfigure.excludeproperty. In this case it would be:Does that meet your needs?
Thank you very much! Yes, it helps - also with other issues.