源文地址:http://www.cnblogs.com/hoojo/archive/2011/03/30/1999563.html
这边我是用Spring的jar包是Spring官方提供的,并没有使用CXF中的Spring的jar文件。
<!-- 加载spring容器配置 -->
<listener>
listener-class>org.springframework.web.context.ContextLoaderListener</>
<!-- 设置spring容器加载配置文件路径 -->
context-paramparam-name>contextConfigLocationparam-value>classpath*:applicationContext-server.xml>
>org.springframework.web.util.IntrospectorCleanupListenerservletservlet-name>CXFServiceservlet-class>org.apache.cxf.transport.servlet.CXFServletservlet-mappingurl-pattern>/*>
然后在src目录中,新建一个applicationContext-server.xml文件,文件内容如下:
<?xml version="1.0" encoding="UTF-8"?beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans >
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd"
注意上面的带下划线加粗部分,这个很重要的哦!不能写错或是遗漏了。