After upgrading to version 2.2.0 the method findCandidateComponents
of class ClassPathScanningCandidateComponentProvider
, seems not found the classes with the specified user package name.
Comment From: wilkinsona
Thanks for the report, but I can't tell what the problem might be from the information that you have provided thus far. ClassPathScanningCandidateComponentProvider
is part of Spring Framework so it could be that the problem lies there rather than in Spring Boot. Its ability to find entries on the classpath is also affected by things like Spring Boot's LauchedURLClassLoader
and fat jar support so the problem could be in Spring Boot.
In short, if you'd like us to spend some time trying to diagnose the problem that you are having, please take some time to describe it in detail and to provide a small sample that reproduces it, in the form of a project that has been zipped up and attached to this issue.
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Comment From: graiffr
Hello, I have attached BootTest.zip a little test code so you can investigate about the issue.
Comment From: wilkinsona
Thanks for the sample. There is no retention policy on your custom annotations so it defaults to RetentionPolicy.CLASS
. If you configure runtime retention (@Retention(RetentionPolicy.RUNTIME)
) you will see that BeanTwo
is found as expected.
It was a bug in Spring Framework 5.1 that led to annotations without runtime retention being discovered. That was corrected in https://github.com/spring-projects/spring-framework/issues/22886.
Comment From: graiffr
You are right. Thank you.