小编rzc*_*zch的帖子

在具有共享服务的单个应用程序中将Apache cxf与spring mvc一起使用

我目前正在开发一个基于spring MVC的项目,它只是一个使用spring MVC模板的标准项目.所以我有web.xml和servlet-context.xml.

我正在努力将Apache cxf Web服务添加到这个项目中,并且遇到与现有Spring MVC共享服务的一些问题.

我最初的方法是尝试使Web服务正常工作,所以这里的web.xml看起来像:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <!-- The definition of the Root Spring Container shared by all Servlets 
        and Filters -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/root-context.xml
        /WEB-INF/spring/jaxwsServlet/jaxwsServlet-context.xml
        </param-value>
    </context-param>




    <!-- Creates the Spring Container shared by all Servlets and Filters -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!-- Process web service requests -->
    <servlet>
        <servlet-name>jaxws</servlet-name>
        <servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>jaxws</servlet-name>
        <url-pattern>/industryAspectWS</url-pattern>
    </servlet-mapping>


    <!-- Processes application requests -->
    <servlet>
        <servlet-name>appServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
        </init-param> …
Run Code Online (Sandbox Code Playgroud)

apache model-view-controller spring hibernate cxf

6
推荐指数
1
解决办法
7200
查看次数

标签 统计

apache ×1

cxf ×1

hibernate ×1

model-view-controller ×1

spring ×1