package com.ankurm.rabbit; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.testcontainers.service.connection.ServiceConnection; import org.springframework.context.annotation.Bean; import org.testcontainers.rabbitmq.RabbitMQContainer; import org.testcontainers.utility.DockerImageName; /** * The Testcontainers route, for machines that have a Docker daemon. * *

{@code @ServiceConnection} supplies host, port, username and password to the * auto-configuration, so no {@code spring.rabbitmq.*} property and no * {@code @DynamicPropertySource} block is needed. * *

The Maven coordinate is {@code org.testcontainers:testcontainers-rabbitmq}. * Testcontainers 2.x prefixed every module artifact; the old {@code org.testcontainers:rabbitmq} * stopped at 1.21.4 and is not managed by the Boot 4.1 BOM. * *

The committed transcripts under {@code docs/output/} came from a broker started by * {@code scripts/broker.sh} instead, on a machine with no Docker — see the module README * for why that matters and what version it was. */ @TestConfiguration(proxyBeanMethods = false) public class TestcontainersConfiguration { @Bean @ServiceConnection RabbitMQContainer rabbitContainer() { return new RabbitMQContainer(DockerImageName.parse("rabbitmq:4.1-management")); } }