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

    @Inject validation bringing up test classes

    spinner

      hello,

       

      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:

       

      {code}

      @Inject @Authenticated

      private User user;

      {code}

       

      and an UserManager with:

       

      {code}

      @Produces @Authenticated @Named("currentUser")

      public User getCurrentLoggedUser()

      {

            return currentLoggedUser;

      }

      {code}

       

       

      Works perfectly.

       

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

       

      at a testClass that  has the method:

       

       

      {code}

      @Produces

      @Authenticated

      User getRegisteredUser()

      {

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

      }

      {code}

       

       

      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.