Search code examples
spring-cloud-streamspring-rabbit

Disable Spring Cloud Stream Rabbit for tests


I use:

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
        <version>3.0.1.RELEASE</version>
    </dependency>

I need to disable Rabbit for testing the application. I tried this:

spring:
    cloud:
       config:
           enabled: false
           discovery:
               enabled: false

It didn't work.

What do I need to do to prevent the Rabbit components from starting?


Solution

  • add spring-cloud-stream-test-support to pom.xml

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-stream-test-support</artifactId>
        <version>3.0.1.RELEASE</version>
        <scope>test</scope>
    </dependency>