I haven't used Salve with Wicket, but I've been using the wicket-guice
integration quite extensively. The reason I'm answering this is that I feel
that many of the use cases of Salve can be solved with pure vanilla Guice.
In cases where you can't control the instantiation of objects, you can use
static injection, which is a bit dirty, but IMO cleaner than
instrumentation. :) So this post is maybe a tiny bit off topic. :)

The way I've been doing it is by using the guice-servlet package which
allows you to extend a GuiceServletContextListener to create a Injector. To
tell your servlet container about this, put something similar into your
web.xml:

        <listener>
        
<listener-class>dk.dtu.kiosk.guice.MyGuiceServletContextListener</listener-class>
        </listener>

Then I use the wicket-guice integration for hooking the two together. To
bootstrap Wicket with Guice you simply use the following in your web.xml

        <filter>
                <filter-name>myApplication</filter-name>
                <filter-class>
                        org.apache.wicket.protocol.http.WicketFilter
                </filter-class>
                <init-param>
                        <param-name>applicationFactoryClassName</param-name>
                        <param-value>
                                
org.apache.wicket.guice.GuiceWebApplicationFactory
                        </param-value>
                </init-param>
                <init-param>
                        <param-name>injectorContextAttribute</param-name>
                        <param-value>com.google.inject.Injector</param-value>
                </init-param>
        </filter>

Voila! Now you can use the @Inject annotation in any Wicket component. You
also have the option of using Providers if you need something dep. injected
or in the difficult cases static injection.

regards,
Guðmundur Bjarni
-- 
View this message in context: 
http://www.nabble.com/Salve-and-Guice-tp20087649p20088079.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to