I have an EJB correctly deployed in Wildfly application server. I can inject it using @EJB annotation, however now, I would like to wrap into a cdi bean to be able to inject it using @Inject annotation. For that I have created a class ResourceProducer which inject the EJB using @EJB and then wrap it into a cdi bean.
Here is the code:
public class ResourceProducer {
@EJB
BusinessHandler businessHandler;
@Produces
@Named("myBusinessHandler")
public BusinessHandler getMyBusinessHandler() {
return businessHandler;
}
}
Then in the injection point I inject the bean using
@Inject
@Named("myBusinessHandler")
private BusinessHandler handler;
However Eclipse is telling me "No bean is eligible for injection to the injection point [JSR-299 §5.2.1]". What I'm doing wrong? DO you see something I'm missing. Any help would be appreciated.
Thank you!!
@Inject, why the wrapper? - Alexander Langer