Yes, you can, but as EJB introduces the business view, the only kind of business that you publish is the @Local , which is used by default when implementing the interface ( IBean in your case is the local business interface). So, if you want to enter the bean itself, you need to tell the container that you are using a view without an interface.
In your example, if you still want to implement your interface and insert a Bean , you should use the @LocalBean annotation, which means the bean provides a view without an interface:
@Stateless @LocalBean // <-- no-interface view class Bean implements IBean { ... } interface IBean { .... } @SessionScoped class Scoped { @Inject Bean bean; //Should be OK }
Or, if you do not want to implement any interface, then the bean by default defines a view without an interface:
@Stateless class Bean { ... } @SessionScoped class Scoped { @Inject Bean bean;
See also:
Tarik
source share