Andy Wilkinson opened SPR-17552 and commented

Please see the referenced Spring Boot issue for a sample that reproduces the problem and my analysis of the cause.


Affects: 5.1.3

Reference URL: https://github.com/spring-projects/spring-boot/issues/15348

Comment From: jhoeller

It does not look like we can do anything about this. During component scanning, the state of the bean factory is incomplete still, so the degree of condition checking that we can do there is limited. It seems sensible to put any such demanding conditions onto configuration classes only, not onto independent scanned bean classes.