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

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

Reply to this message by going to Community
[http://community.jboss.org/message/580888#580888]

Start a new discussion in JBoss Tools at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to