-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use spring.components only for JARs that define an index #25886
Comments
@ascheman thanks for the report. This is working as documented as the context indexer is now a global on/off switch for the whole It is a different topic but I'd argue that We've tried in the course of the Final note: unless you have hundreds of beans and you're scanning packages with thousands of classes, we don't believe the indexer makes much of a difference so please keep that in mind as well. |
Thanks for your feedback as well, @snicoll. I was aware from my discussions with other Spring developers that an index only might significantly speed up the start of a Boot application if the applications uses large numbers of beans. My customer's application has at least 130 beans on its own plus the beans of used jars. |
The beans of "used jars" don't matter here as most libraries don't use classpath scanning.
I am not aware of that conversation but it only makes a "significant difference" with a crazy high number of beans (more in the order of thousands and even more classes to scan). Despite what you may hear on the Internet, classpath scanning is actually very fast. The indexer is indeed a niche solution for those very large applications. |
Is there any update on this issue? I am trying to find a way to scan the beans in dependent libs by using indexer. |
Thanks for the nudge. This is largely superseded by our AOT effort in Spring Framework 6. As for your wish to scan beans in dependent lib, I can't comment on that but the indexer is not meant to be used by user code. |
I've created #30431 for the follow-up of deprecating the indexer. |
Affects: 5.2.9
I am trying to use
spring-context-indexer
on my project. It creates aMETA-INF/spring-components
file with a list of my own beans. So far, so good.However, if I have additional components on my classpath, e.g.,
keycloak-spring-boot-starter
, these provide beans on their own - but they are not instantiated any longer since they are missing from the generated index. I guess the application container should still perform a classpath search even if some beans could be instantiated right from the index.On behalf of my customer project I have provided a show case of the problem with one of my pet projects:
Please clone https://github.com/dukecon/dukecon_feedback,
Switch to branch feature/spring-context-indexer,
Call
./mvnw clean test
and check for the errors.The error can also be found in our Gradle Enterprise test reports at https://gradle.dukecon.org/s/kxjpnfo3bglpy/tests/org.dukecon:dukecon-feedback:surefire:test/org.dukecon.feedback.adapters.jpa.FeedbackStoreJPAPostgresTest/testToSave?anchor=e30&focused-exception-line=0-4-2-0-0#1
Or on our Jenkins server at https://dev.dukecon.org/jenkins/job/dukecon_feedback/job/feature%252Fspring-context-indexer/2/console
Thanks to @mp911de for discussions and for encouraging me to raise this issue.
The text was updated successfully, but these errors were encountered: