Hi ,
There are several phases of the configuration loading in CXFServlet.
Please ref [1]'s loadBus() for more information
1. Loading the Spring ApplicationContext from the ServletConfig, which
means the bean.xml will take effect first, and create the Spring Bus
with this application context.
2. If the applicationContext is null , CXFServlet will create a
springBus with out this applicationContext
3. After the bus initialized, CXFServlet try to load cxf-servlet.xml
for publishing the endpoints
For the SpringBus initializing, there are also several steps to look up
the configuration files, please ref [2]'s getConfigResources() method
for more information
1. Checking if there is a bus named with cxf in the applicationContext,
if the bus is already there , we do not need search the core and cxf
extension spring configuration resources.
2. If SpringBus is not create with cfgFile (file name or url) specified
, it will find user defined configuration form the the system property
"cxf.config.file" and "cxf.config.file.url"
[1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
[2]https://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
Willem.
Benson Margulies wrote:
I see log messages indicating that CXF is looking for cxf.xml even when
I have my own beans. My guess is that unless you initialize the entire
system (starting from the bus) CXF will always look for cxf.xml, and, in
fact, there may be no conditions in which it fails to do that.
-----Original Message-----
From: Glen Mazza [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 21, 2007 1:10 PM
To: [email protected]
Subject: Re: Difference between cxf.xml and cxf-servlet.xml?
OK, I'm still researching all of this (and others' related
emails) to update the documentation--but I have one question
left: Does anyone know, that if I have *both* a Spring
configuration file (i.e., the "beans.xml"[1] file in the
java_first_spring_support sample below) declared in the
web.xml[2] and cxf.xml in the classpath, if *both* will be
loaded? Or does the former prevent the latter from being
loaded and processed? The CXF source code that covers this
is somewhat cryptic but I can research it more thoroughly if
necessary.
Thanks,
Glen
[1] http://tinyurl.com/352htd
[2] http://tinyurl.com/3djrlz
Am Freitag, den 16.11.2007, 10:53 +0800 schrieb Jeff Yu:
java_first_spring_support sample "beans.xml", it doesn't
need to have
a cxf-servlet.xml in the WEB-INF folder.
Excellent example. Thanks for pointing it out.
In fact, the cxf-servlet.xml just replace the http
transport ID to the
servlet. ( in this case, the cxf-servlet.xml in the
cxf-rt-transports-http module).
Good point. I just noticed there are two different
cxf-servlet.xml's, the one above (in META-INF of the CXF JAR)
just does the above as you're saying.
The reason why the cxf-servlet.xml in the WEB-INF folder
would works,
in this case, the cxf-servlet.xml contains the endpoint
configuration
such as<jaxws:endpoint>.., because we define a
"<servlet-name>cxf</servlet-name>" in the web.xml, by default, it
would pick up the "cxf-servlet.xml" in the war..
Actually, that is exactly how Spring MVC's DispatcherServlet
works, xxxx-servlet.xml; but in our CXFServlet class it is
hardcoded to look for a "cxf-servlet.xml" no matter what the
servlet-name is.
so, to be specific, which case of cxf-servlet.xml do you
refer to? For
the cxf-servlet.xml in the WEB-INF folder, it is optional.
You can do
as same as java_first_spring_support sample did...
use another xml, and then ask spring's
ContextLoaderListener to load it..
Thanks
Jeff
Glen Mazza wrote:
Do we have a sample anywhere of the syntax of
this--specifying the
Spring app context in the XML, and what such a config file would
look like?
Thanks,
Glen
Am Donnerstag, den 15.11.2007, 11:12 -0500 schrieb Jiang,
Ning (Willem):
If you specify the Spring application context in your
web.xml file.
You do not need to touch any of cxf.xml and cxf-servlet.xml.
I admit that CXF provides lots of configuration here.
Willem.
-----Original Message-----
From: Randy Burgess [mailto:[EMAIL PROTECTED]
Sent: Thu 11/15/2007 21:52
To: [EMAIL PROTECTED]
Subject: Re: Difference between cxf.xml and cxf-servlet.xml?
I don't even use either file and my services work without any
issues. I use applicationContext*.xml files since I was using
Spring before CXF and didn't see the point in creating either.
Regards,
Randy Burgess
Web Applications Developer
Nuvox Communications