Wildfly 8.2.0
I have a Stateless
EJB and an interface.
@Local
@Stateless
public class Bean implements IBean{
...
}
@Local
public interface IBean {
...
}
But I get a WELD Error. If Bean doesn't implement the interface there is no errors. According to https://stackoverflow.com/a/13988450/2023524 and https://blogs.oracle.com/arungupta/entry/what_s_new_in_ejb there should be no error.
Error:
WELD-001408: Unsatisfied dependencies for type Bean with qualifiers @Default
at injection point [BackedAnnotatedField] @Inject private mypackage.anotherBean.bean
Update:
I've tried all possible combinations with Local
but it doesn't help. Only if interface is removed there is no error.
@Stateless
public class Bean implements IBean{
...
}
@Local
public interface IBean {
...
}
//*****************************
@Stateless
public class Bean implements IBean{
...
}
public interface IBean {
...
}
//************************************
@Local
@Stateless
public class Bean implements IBean{
...
}
public interface IBean {
...
}
When you want to inject a bean whether by EJB (using @EJB
) or CDI (using @Inject
) container you declare a variable with interface type. Concrete implementation of declared interface is found by a container during application deployment. In your example the problem is not with annotations but with a declared type being injected (Bean
instead of IBean
).