You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Ryan Heaton <ry...@webcohesion.com> on 2008/11/22 00:12:49 UTC

CXF Spring Configuration: Context Load Order

Hi.

I want to put my CXF spring configuration in my Spring servlet context
file and not my global Spring web application context, but if I do
that, the CXF servlet doesn't pick up my endpoints because the
components are wired before reading the servlet context.

Say, for example, I've got the configuration laid out by
http://cwiki.apache.org/CXF20DOC/writing-a-service-with-spring.html.
And I've got my files like this:

WEB-INF/applicationContext.xml
WEB-INF/cxf-servlet.xml

Spring says that the beans in each of these files are loaded into
separate application contexts, but the specific servlet one is a child
of the global applicationContext.xml one.

If I have my JAX-WS beans declared in cxf-servlet.xml, those beans
don't get picked up because the bus, transport factories, etc are
loaded in the global application config (see
CXFServlet.updateContext() method).

Why this behavior?

-Ryan

Re: CXF Spring Configuration: Context Load Order

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
I haven't had that problem where stuff from one context couldn't see
stuff from another.  What if you do something like this (in web.xml)?

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/cxf-context.xml
            /WEB-INF/some-other-context.xml
        </param-value>
    </context-param>

That should result in all the listed Spring contexts being "in the
same space" even though the bean definitions may be in multiple
context config files.

Thanks,
      Aaron

On Fri, Nov 21, 2008 at 6:12 PM, Ryan Heaton <ry...@webcohesion.com> wrote:
> Hi.
>
> I want to put my CXF spring configuration in my Spring servlet context
> file and not my global Spring web application context, but if I do
> that, the CXF servlet doesn't pick up my endpoints because the
> components are wired before reading the servlet context.
>
> Say, for example, I've got the configuration laid out by
> http://cwiki.apache.org/CXF20DOC/writing-a-service-with-spring.html.
> And I've got my files like this:
>
> WEB-INF/applicationContext.xml
> WEB-INF/cxf-servlet.xml
>
> Spring says that the beans in each of these files are loaded into
> separate application contexts, but the specific servlet one is a child
> of the global applicationContext.xml one.
>
> If I have my JAX-WS beans declared in cxf-servlet.xml, those beans
> don't get picked up because the bus, transport factories, etc are
> loaded in the global application config (see
> CXFServlet.updateContext() method).
>
> Why this behavior?
>
> -Ryan
>