Wildfly 8.2.0
I have a Stateless
EJB and an interface.
@Local
@Stateless
public class Bean implements IBean{
...
}
@Local
public interf
You need to remove @Local
from Bean.
@Stateless
public class Bean implements IBean{
...
}
Because you define 2 possible Local WELD doesn't know which one to use.
The oracle documentation show this too with @Remote
interface:
@Remote
public interface Foo { . . . }
@Stateless
public class Bean implements Foo, Bar {
. . .
}
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
).