The test infrastructure looks for @SpringBootConfiguration annotated types via AnnotatedClassFinder that uses ClassPathScanningCandidateComponentProvider internally.

But the annotation does not declare it is a target for classpath scanning and therefore the entry is not found when the components index is in place.

Comment From: sdeleuze

We would need that for the upcoming native JUnit 5 support that we would like to release in Spring Native 0.10.0 based on Spring Boot 2.5.0.

Comment From: sdeleuze

I did a test locally with @Indexed added to @SpringBootConfiguration, the generated spring.components is:

com.example.commandlinerunner.CLR=org.springframework.stereotype.Component
com.example.commandlinerunner.CommandlinerunnerApplication=org.springframework.stereotype.Component,org.springframework.boot.SpringBootConfiguration

And it solves the error I had previously when running native tests with Gradle.