No, there's no state in the module.  But if I have a class bound in
Singleton scope in my module and the module is loaded twice, each injector
will have a separate instance of the class.

On Sun, Aug 30, 2009 at 3:24 AM, Stuart McCulloch <[email protected]> wrote:

> 2009/8/30 Chris <[email protected]>
>
>>
>> Is there a way to inject JAX-WS web services and servlets using the
>> same, single instance of my Guice module?
>>
>> Say I have a web service:
>>
>> @GuiceManaged(module=MyModule.class)
>> @WebService
>> class MyWebService {
>> }
>>
>> and a GuiceServletContextListener
>>
>> class MyGuiceServletContextListener extends
>> GuiceServletContextListener {
>>    protected Injector getInjector() { return Guice.createInjector(new
>> MyModule()); }
>> }
>>
>> My web services are injected using the guicemanaged.jar by annotating
>> the SIB class with a @GuiceManaged(module=MyModule.class) annotation
>> and my servlets are injected using
>> GuiceServletContextListener.getInjector() method and each instantiates
>> its own copy of MyModule.
>>
>> Is there a way to have both the GuiceManaged and
>> GuiceServletContextListener use the same instance of MyModule?  Can/
>> should I make MyModule a static class?
>>
>
> just wondering why you need a single instance of your module? does it have
> some sort of state?
>
>
>>
> --
> Cheers, Stuart
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to