Hmm, IIRC it injects by type if the qualifier doesn't matches. Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau
2014-04-09 15:23 GMT+02:00 Alex Soto <[email protected]>: > 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.
