0

我正在使用 Mule 3 和 Spring mvc 3 创建一个 webapp,问题是我无法在 spring 控制器中获取 mule bean。我的应用程序上下文使用 mule 上下文加载,并且在 spring 上下文中不可用,当我在 spring 上下文中加载应用程序上下文时,mule 和 spring 都对单个 bean 具有不同的引用。如何在 spring mvc 控制器中获取 mule 上下文,以便可以引用同一个 bean 对象。对于参考,我的 web.xml 定义如下:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         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"
         id="return-label-service" version="2.5">


    <display-name>return</display-name>

   <context-param>
        <param-name>org.mule.config</param-name>
        <param-value>mule-return-label-flow.xml,applicationContext.xml </param-value>
    </context-param>

    <context-param>
        <param-name>mule.serverId</param-name>
        <param-value>return-label-service</param-value>
    </context-param>    

    <listener>
        <listener-class>
            org.mule.config.builders.MuleXmlBuilderContextListener
        </listener-class>
    </listener>

    <!-- <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath://applicationContext-web.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener> -->

    <servlet>
        <servlet-name>spring</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:applicationContext-web.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>spring</servlet-name>
        <url-pattern>*.html</url-pattern>
    </servlet-mapping>



</web-app>
4

1 回答 1

0

This is a possible duplicate of this question. Moreover, I think there is good documentation available here and here

于 2013-06-28T05:39:29.127 回答