[jboss-user] [JBoss Tools] - @Inject validation bringing up test classes

spinner do-not-reply at jboss.com
Fri Jan 14 12:31:40 EST 2011

spinner [http://community.jboss.org/people/spinner] created the discussion

"@Inject validation bringing up test classes"

To view the discussion, visit: http://community.jboss.org/message/580888#580888


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 warning.

Reply to this message by going to Community

Start a new discussion in JBoss Tools at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110114/4ed53c87/attachment.html 

More information about the jboss-user mailing list