Search code examples
dependency-injectionjava-ee-6cdi

CDI when injectionpoint.getBean() can be null


I'm playing with CDI producers and spotted in doc that

InjectionPoint.getBean()

can return null if the injection point does not belong to a bean. What does it effectively mean? How can injection point not belong to a bean? Is it possible to inject something into something other what is not CDI bean?

I'd like to get class name of class containing this injection point and now I don't know if I can rely on getBean() method if it can return null?


Solution

  • Chances are VERY good (AFAIK) you'd only see a null if you manually created an InjectionPoint through an extension.