Skip to content

bootTestRun throws error when you have multiple @DynamicPropertySources in Spring Boot 3.2.2 -- works fine in 3.2.1 #39282

@zsait-clearstreet

Description

@zsait-clearstreet

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by anothertype: regressionA regression from a previous release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions