Affects: 2.2.4.RELEASE

The @ConfigurationPropertiesScan annotation does not work in a @WebFluxTest and fails to pick up any classes. Referencing classes explicitly via @EnableConfigurationProperties works but shouldn't be required. The project uses Kotlin 1.4.

Here is a minimal test case to reproduce the issue: https://github.com/MrBuddyCasino/spring-boot-property-binding-bug

Comment From: wilkinsona

Thanks for the sample.

@WebFluxTest filters the beans that are registered by scanning and this filtering excludes @ConfigurationProperties-annotated beans. This behaviour isn't specific to @WebFluxTest as none (IIRC) of the sliced @…Test annotations include @ConfigurationProperties beans.

I'm flagging this for team attention so that we can discuss what, if anything, we want to do here. It may be that we decide to change the behaviour or perhaps just make and update to the documentation to clarify the current behaviour.

Comment From: MrBuddyCasino

Thanks for the quick feedback. In the meantime, I guess @EnableConfigurationProperties is the best workaround for now?

Comment From: snicoll

I don't think it is a workaround but what you should be doing the same way you should use @Import if you want to add an additional component. The current behaviour is what we expect to happen, see this comment and #16659.

As for the documentation it currently states the following:

@WebFluxTest auto-configures the Spring WebFlux infrastructure and limits scanned beans to @Controller, @ControllerAdvice, @JsonComponent, Converter, GenericConverter, WebFilter, and WebFluxConfigurer.