How to get rid of "Ambiguous Dependency"? Bogus CDI detected? Follow
Answered
Our project has some dozen maven modules. It uses both Spring and JSF.
Many injection points are highlighted by IDEA as having an "Ambiguous Dependency".
I figure that the reason is that IDEA uses both Spring and CDI resolutions.
Note the _two_ icons on these screenshots.
The left (green, Spring) icon shows the correct beans:
The right one (brown, CDI(?)) shows wrong ones:
If I disable the CDI plugin completely, then the error is gone. Unfortunately then JSF support is also gone, because it depends on CDI.
There are only Spring and JPA facets in my project configuration.
Any ideas?
Please sign in to leave a comment.
Anybody?
I noticed that if I remove the cdi-api.jar IDEA behaves correctly.
However our code uses annotations like @ApplicationScoped and uses the mechanism described here to map CDI scopes to Spring: https://matthiaswessendorf.wordpress.com/2010/05/06/using-cdi-scopes-with-spring-3/
Is there any way to disable CDI injection in IDEA for a project?
Please submit a bug at https://youtrack.jetbrains.com/issues/IDEA. Thank you.
Thanks! Done: https://youtrack.jetbrains.com/issue/IDEA-157744