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
Tests fail when using spring-context-indexer [SPR-17545] #22077
Comments
Juergen Hoeller commented This is more or less by design: You're only supposed to apply |
Jean-Pierre Bergamin commented Ok I see. Although I think this makes this feature very hard to use. I cannot imagine a (simple) CI/CD setup that allows you to do that: running tests without the The other approach would be some way to suppress using the spring.components file in tests - which would simplify CI/CD setup of course. |
Stéphane Nicoll commented I am not sure I got that Juergen Hoeller. Jean-Pierre Bergamin your build setup is broken, I don't know how to configure Gradle to let it run on your tests but that's not really something we can help you with here. When you enable the indexer, all your assets must use the indexer given that, as you've noticed, regular component scan will be switched off in presence of such file. I've quickly tried with a maven project and |
Jean-Pierre Bergamin commented Ah. In gradle you need to explicitely set Now it works: ractive/spring-context-indexer@6023579 It would be nice to put a word about that in the documentation: https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#beans-scanning-index
As simple as Feel free to close this ticket. |
Juergen Hoeller commented Stéphane Nicoll, that's essentially what I meant: either only apply it to your production deployment, or add the indexer to your test codebase as well. In any case, good to hear it's sorted out now... |
Jean-Pierre Bergamin opened SPR-17545 and commented
Test configurations are not considered anymore while running tests when the spring-context-indexer is used in the project. Out of the blue I assume that only the components in the spring.components file are loaded and test configurations are left alone - which breaks tests.
This very simple project shows this behaviour: https://github.com/ractive/spring-context-indexer
If you enable the
spring-context-indexer
in thebuild.gradle
file, tests fail because not thetestClock
bean in theTestConfig
class is used, but the actual clock bean defined in theConfig
class.Reference URL: https://github.com/ractive/spring-context-indexer
The text was updated successfully, but these errors were encountered: