0 Replies Latest reply on Jan 14, 2011 1:15 PM by spinner

    @Inject validation bringing up test classes




      I was wondering if the validation of @Inject command should consider a bean produced in a test package as eligible bean.


      It's considering now, but it doesn't feel right.


      I'll try to explain it better:


      I have for example an AccountBean with:



      @Inject @Authenticated

      private User user;



      and an UserManager with:



      @Produces @Authenticated @Named("currentUser")

      public User getCurrentLoggedUser()


            return currentLoggedUser;





      Works perfectly.


      The thing is that I have another place where I produce this @Authenticated user,


      at a testClass that  has the method:






      User getRegisteredUser()


            return em.find(User.class, "me");





      Just to clear it up, the application is working fine, the problem I'm mentioning, is that the validation in eclipse

      shows a warning "Multiple beans are eligible for injection to the injection point" and points both to testclass and userManager class.


      And that makes me wonder if there's not a real danger in there ( or is there? ), maybe it shouldn't show a warn.