Marko Lukša commented on Feature Request WELD-964

Well, no, that's not what I meant. Unfortunately, the whole thing is a bit more complicated.

When Y is not on the classpath, bean X is ignored and its injection points will not be validated. But if bean X is also injected into some other bean Z, Weld will throw an unsatisfied dependencies for type X.

This example should make it easier to understand:

class BeanX {   // is on classpath
    @Inject BeanY beanY;
}

class BeanY {   // is on classpath
    MissingClass missingClass;
}

class MissingClass {  // IS NOT ON CLASSPATH
}

Even though BeanY is on the classpath, Weld will ignore it, since it can't introspect it. When Weld calls BeanY.class.getDeclaredFields() it receives ClassNotFoundException. So, since Weld cannot process BeanY, it has to ignore it.

This means that BeanY will not be a managed bean and when Weld encounters injection point BeanX.beanY it will throw an unsatisfied dependency exception.

M< pull request improves the exception message in this scenario. It will say something like: "Unsatisfied dependencies for type BeanY... Class BeanY is on the classpath, but was ignored because a class it references was not found: MissingClass"

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira