简体   繁体   中英

Mule 3 and Spring MVC 3 integration

I am creating a webapp with Mule 3 and Spring mvc 3, the problem is I am not able to get mule beans in spring controllers. My application context load with mule context and is not available in spring context, when I load application context in spring context then mule and spring both have different reference to a single bean. How can I get mule context in spring mvc controller so that I can refer to the same bean object. For ref my web.xml is defined below:

<?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>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM