-
Notifications
You must be signed in to change notification settings - Fork 41.7k
Description
With Spring Boot 3.2.2, if you have multiple classes with @DynamicPropertySource it throws the below error. This works fine with 3.2.1
The bean 'org.springframework.boot.testcontainers.properties.TestcontainersPropertySource$EventPublisherRegistrar' could not be registered. A bean with that name has already been defined and overriding is disabled.
To replicate, see this fork of the testcontainers-quickstart with spring version upgraded to 3.2.2 and adding multiple classes with @DynamicPropertySource
https://github.com/zsait-clearstreet/testcontainers-java-spring-boot-quickstart
The commit diff
testcontainers/testcontainers-java-spring-boot-quickstart@main...zsait-clearstreet:testcontainers-java-spring-boot-quickstart:main
Try running the 'bootTestRun' task you will see
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'org.springframework.boot.testcontainers.properties.TestcontainersPropertySource$EventPublisherRegistrar' could not be registered. A bean with that name has already been defined and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
Works fine if you downgrade to version Spring boot version 3.2.1