Hi Sean,

Keep in mind that Guice isn't directly injecting your Wicket components.
That happens through org.apache.wicket.guice.GuiceComponentInjector. More
specifically, see GuiceFieldValueFactory#supportsField() which only
recognizes @Inject annotated fields as requiring injection.

HTH,
Dan

On Thu, Aug 9, 2012 at 7:32 AM, Lawrence, Sean <[email protected]>wrote:

> Hi,
>
> I'm attempting to use wicket-guice to inject Logger references into my
> application with logging.
>
> So instead of:
>
> Logger logger = LoggerFactory.getLogger(HomePage.class);
>
> I would rather:
>
> @Log
> Logger logger;
>
> I've followed the guice documentation closely and have been frustratingly
> unable to get these statements working. Does anyone have any experience
> with this and can provide insight to why it's not (see links below)? All
> other objects I have provided or binded are getting injected, however, all
> my logger statements are throwing NPE.
>
> See the following two links for the documentation I have been using. I
> also have a quick-start wicket application that I have prepared if anyone
> is curious (it's a zipped up eclipse project ... I may have to rename
> .zippp to get around the corporate firewall)
>
> http://code.google.com/p/google-guice/wiki/CustomInjections
>
> http://forkbomb-blog.de/2012/slf4j-logger-injection-with-guice
>
> I have also tried the Sli4j library, but was getting NPEs as well:
> http://sli4j.googlecode.com/svn/site/1.0/index.html Does anyone have
> experience with sli4j?
>
> Finally, does anyone have a maven archetype? My coworker is looking into
> adding logger injection to the 55minutes prototype.
>
> Thank you!
>
>
> Sean Lawrence
>
> ________________________________
> This e-mail and any attachments are intended only for the use of the
> addressee(s) named herein and may contain proprietary information. If you
> are not the intended recipient of this e-mail or believe that you received
> this email in error, please take immediate action to notify the sender of
> the apparent error by reply e-mail; permanently delete the e-mail and any
> attachments from your computer; and do not disseminate, distribute, use, or
> copy this message and any attachments.
>

Reply via email to