Currently there is no way of getting the injector from jax-ws guicemanaged
(or setting it)

The best fix is probably to pin the injector to the
WebServiceContext/ServletContext like guice servlet is doing, I'll
experiment with ways of exposing the injector and get back real soon

I'm also currently doing a better jax-ws - guice servlet integration
(minimal web.xml and no sun-jaxws.xml), but i've run into some problems
there and getting answers from the jax-ws authors is quite difficult. If
anyone knows an answer to this question, i'd be happy:
http://forums.java.net/jive/thread.jspa?threadID=63821&tstart=15

-- 
Marcus Eriksson


On Sun, Aug 30, 2009 at 5:00 PM, Stuart McCulloch <[email protected]> wrote:

> 2009/8/30 Chris Stockton <[email protected]>
>
>> 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.
>>
>
> note that Guice singletons are per-injector, so you would get two instances
> of the class even if you passed the same module instance into each
> injector:
>
>    http://groups.google.com/group/google-guice/msg/9350be0b7d596795
>
> ( unless of course you bound the class using 'toInstance()' to an object
> that
>   you created in the module, rather than binding it in the singleton scope
> )
>
> imho it looks more like you need to use the same injector, rather than the
> same module instance - is there any way you could get the injector from
> JAX-WS and re-use that in the servlet context listener? (or vice-versa)
>
> 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
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
> --
> 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