PDA

View Full Version : InjectionPoint for Dependent Producer is null


swiegersf
05-18-2010, 09:13 AM
Hi there,

I am trying to inject a Logger into my components using an InjectionPoint (as per the Weld user guide section 4.11):

@Produces
public Logger getLogger(InjectionPoint ip) {
return LoggerFactory.getLogger(ip.getMember().getDeclarin gClass());
}

(P.S. your code formatting does not seem to work for some reason)

Upon executing the above, the ip reference is null. If I change the scope of the Producer to @ApplicationScoped, then the injection point is not null (it works, but not really, since InjectionPoint is only useful in the Dependent scope).

It may be worth noting that the component that requires the logger has been created in a custom context.

ferg
05-19-2010, 12:06 AM
Thanks! I just checked and we've fixed that bug for 4.0.7, which we're hoping to release some time next week.

swiegersf
05-19-2010, 04:36 AM
Excellent, thanks for the feedback.