“Unsatisfied dependency” warning when injecting Conversation into backing bean
-
26-06-2021 - |
Question
@ConversationScoped
public class BackingBean
{
@Inject Conversation conversation;
public BackingBean() {}
...
}
Why is Intellij giving me a warning: "Unsatisfied dependency: no bean matches the injection point."
The CTRL+F1 detail message is "Detect injection points that have ambiguous dependencies."
It compiles and deploys and seems to run fine on JBoss e.g. I'm able to conversation.begin(), conversation.end(), etc.
Solution
I went to Project Structure --> Modules. I selected my web module. I noticed the CDI facet. I clicked on the facet and noticed that neither of the two radio buttons were selected: Apache Open Web Beans or JBoss Weld. I selected JBoss Weld. Then, an error message appeared:
"The following libraries are missing: weld-api.jar, weld-core.jar, weld-logger.jar, weld-se.jar, weld-servlet-int.jar, weld-spi.jar, weld-tomcat-support.jar, weld-wicket.jar"
I clicked the "Fix" button. A dialog opened, "Setup Library." I had a choice: "Use Library" or "Download."
I chose Download.
Intellij downloaded the eight jar files and installed them in my $PROJECT_HOME/lib directory.
Now, I don't receive any warnings when I inject Conversation.
OTHER TIPS
If it runs on the server you are fine - looks like you either found a bug in Idea or somehow misconfigured the CDI nature of the project (Conversation
is certainly in your classpath, but maybe not scanned by Idea)...
I suspect the latter :)