-
-
Notifications
You must be signed in to change notification settings - Fork 281
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
Running into issues with SpringComponentFinderStrategy tripping over multiple interface hits #103
Comments
For both issues, you may be better off either (1) writing your own component finder strategy, which implements the rules based upon how your codebase is structured or (2) use a different set of strategies based upon naming conventions, etc. This perhaps isn't the answer that you wanted, but FWIW, this is exactly why the client library is open source ... every codebase is structured differently, and the rules for identifying components in one codebase are usually different to others. Hope that helps. |
Wow, thanks for the lightning response. I'm not upset by that answer in the slightest. I definitely figured my issues around the repository stuff were going to necessitate a custom finder strategy. Yay open source! I was thinking that it might be useful for the built in spring component finder to avoid trying to use interfaces that have nothing to do with spring components. Do you see any merit in that? |
I ended up creating an almost clone of SpringComponentComponentFinderStrategy that just added the following check right before it tests for an interface:
|
Working with this strategy:
As it is running through the classes, it comes across one that looks like this:
The
AbstractSpringComponentFinderStrategy.findInterfacesForImplementationClassesWithAnnotation()
method sees the interfacejava.util.function.Consumer
and decides that this component should be represented as that.However, a few loop iterations later, it finds this guy:
And going through the same logic as before, tries to add a second component named Consumer which blows up.
At the top of the loop, there is a check for whether the candidate component already exists in the components, but it is checking on the simple name, not the interface name, so it doesn't see a problem, and there isn't a check whether this interface name already exists prior to trying to insert it.
So.. a few questions:
The text was updated successfully, but these errors were encountered: