In our application we have CDI (@ApplicationScoped annotation) and EJB (@Stateless annotaion) beans that structured like this:
MyInterface
MyAbstractClass
MyBean (CDI or EJB)
I'm using below to get all the beans (CDI and EJB) in my application that implements MyInterface:
@Inject
Instance<MyIterface> beans;
Here I see two weird things:
- I'm getting only CDI beans and not EJB beans.
- When creating EJB bean that implements directly the MyInterface interface, without extending MyAbstractClass, than in this case this bean getting injected by the inject above.
How can I get all the beans, CDI and EJB, with the inject above?