dev@jax-ws.java.net

Re: Spring Support

From: Mohan K R <kmoh.raj_at_gmail.com>
Date: Wed, 13 Dec 2006 11:58:37 -0500

Kohsuke,

Thanks for the reply.

I was trying to draw the analogy from Spring MVC, in that scenario a IoC
Container heirarchy is created with the root
being the bean factory (ApplicationContext) initialized by the Spring
Context Loader Listener. Then, the dispatcher
servlet (in this case WSSpringServlet) would create its own
ApplicationContext and tag itself as child of the "root"
context created by the ContextLoaderListener. Now, it is debatable the
benefits of creating an IoC Hierarchy!

About the other question, yes wac is the WebApplicationContext, which is the
IoC container, so it is like a Chicken
and egg thing, I cannot inject it into the SEI. I need to access the IoC so
that I can retrieve the beans needed to initialize
the SEI properly. Currently the way to get the "wac" (that I know of) is
using the ServletContext. But, in JAX-WS 2.0
I cannot seem to figure out how to get the ServletContext in a @PostContruct
annotated Method. I can get the
servletcontext by @Resource injection trick but it only works for @WebMethod
methods. I would like to get a
reference to the IoC only once at SEI *initialization* phase (preferably in
@PostContstruct) but I don't know how to do
this in JAX-WS 2.0? I have seen some posts where the suggestion was to use
the JAX-RPC Lifecycle methods for SEI,
but I don;t know whether it is OK to use that if I am migrating to JAX-WS
2.0.

Thanks
Mohan



On 12/12/06, Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_sun.com> wrote:
>
> Mohan K R wrote:
> > Koshuke,
> > Thanks for the reply and great work with with updating the maven repo.
> >
> > Yes, I did look at the documentation. It appears that uses Spring IoC
> and
> > xml
> > schema extension capability to replace sun-jaxws.xml, which I definitely
> > like.
>
> Good.
>
> > My question was really how do I get access to the wac in the SEI? I
> guess I
> > could
> > get it in a roundabout way by using @Resource -> webServiceContext.
>
> Pardon my ignorance, but what is 'wac'?
> org.springframework.web.context.WebApplicationContext?
>
> I'm no Spring expert, but since now your SEI is configured by Spring,
> shouldn't it be able to inject WebApplicationContext for you?
>
>
> > It would be nice if the WSSpringServlet supported it's own IoC which
> would
> > be a child
> > of wac (from the contextLoader Listener) and the jax-ws.http bean be
> > retrieved from it.
>
> I'm new to Spring and therefore I don't quite understand what you are
> saying. Any pointer to the Spring documentation would be appreciated.
>
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>
>