I can't get a very simple point on CDI!
I have these classes in my application:
public class CarrelloController extends AbstractController {
@Inject CarrelloService carrelloService;
...
}
@Stateless
public class CarrelloService implements CarrelloDataProvider {
...
}
public interface CarrelloDataProvider {
public Oggetto getSomething(String foo);
}
However, I am getting the following error, after deploying:
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type CarrelloService with qualifiers @Default at injection point [BackedAnnotatedField] @Inject @Default it.footballove.web.controller.CarrelloController.carrelloService at it.footballove.web.controller.CarrelloController.carrelloService(CarrelloController.java:0)
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:359) at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281) at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134) at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:155) at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518) at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68) at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66) at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60) at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Exception 0 :
I get that only using an interface. Abstract class instead makes no problem!
Why?
CarrelloService
and not its interfaceCarrelloDataProvider
. Why are you doing so? – Marco Stramezzi