Hello,
Currently I am developing a demo application I have start playing with
@Produces method and Entity Manager. Let me show the code:
@ApplicationScoped
public class DataSourceProducer {
@PersistenceContext(unitName = "bank")
EntityManager em;
@Produces @BankEntityManager EntityManager entityManager() {
return this.em;
}
}
As you can see I have annotated the produced method with a qualifier.
Then I have two Stateless "DAOs":
One that inject entitymanager as:
@Inject
@BankEntityManager
EntityManager em;
and another one that injects as:
@Inject
@MyEnum
EntityManager em;
Notice that the qualifier is different, but when I run the test the entity
manager is injected inside DAO in both cases. I don't understand why this
happens if @MyEnum annotation is not used as qualifier in any other place
nor in conjunction with @Produces.
Any idea why this happens?
Thank you so much.