How to get rid of "Ambiguous Dependency"? Bogus CDI detected?


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?


Comment actions Permalink


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:

Is there any way to disable CDI injection in IDEA for a project?


Please sign in to leave a comment.