ClassPathScanningCandidateComponentProvider#indexSupportsIncludeFilter
attempts to match jakarta.annotation.ManagedBean
, but the match fails.
Comment From: mhalbritter
Hello! I don't understand. What exactly did you do, what is expected and what happened?
Comment From: aurifolia
I generated an empty spring boot 3.0.0 project with "start.spring.io" and then added a "spring-context-indexer" dependency through gradle, like this annotationProcessor 'org.springframework:spring-context-indexer'
. And then I add @Indexed
on the startup class. The project does generate the META-INF/spring.components
file after compiling, but I find that the spring.components
file is not used when the project is started.
I changed the springboot version to 2.7.6 and found that the spring.components
file was used when the project started.
Comment From: aurifolia
I break points found org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider#findCandidateComponents(String basePackage)
this method called indexSupportsIncludeFilters()
, and indexSupportsIncludeFilters()
returns false. But under the 2.7.6 version indexSupportsIncludeFilters()
returns true.
So scanning the classpath for candidate components under 2.7.6 uses the spring.components
file, but not under 3.0.0
Comment From: sbrannen
StandardStereotypesProvider
was updated to support Jakarta annotations (such as @jakarta.annotation.ManagedBean
) in https://github.com/spring-projects/spring-framework/commit/d84ca2ba90d27a7c63d7b35a6259b5b9cf341118#diff-2bdfddc22d2d1845f4ed7b6705fe73ba79a638f1d739909ab49099cd36a62e0c in conjunction with #25354, but ClassPathScanningCandidateComponentProvider#indexSupportsIncludeFilter
was not updated accordingly and still matches against annotations whose fully qualified names start with "javax."