Community

@Autowiring of beans from Spring applicationcontext

reply from Stefan Rufer in Spring Integration - View the full discussion

I struggled with a similar problem and solved it with the following configuration in web.xml of the WAR file exposing my SOAP service:

 

     <!--
       The MessageDispatcherServlet is the entry point for all kinds of
       SOAP requests. It implicitely loads an application context file
       /WEB-INF/<servletname>-servlet.xml if not configured otherwise.
       However, as we want component scanning and everything
       we configure an own application context and context loader.
      
       Component scanning did not work if relying on the parent
       Spring context (the parent context is the one loaded via
       ContextLoaderListener). It only works if the default spring-ws
       context mechanism is reconfigured to use the application context
       in the classes directory. If done so, <import .../> and component
          scanning works.
     -->
     <servlet>
          <servlet-name>trxservice</servlet-name>
          <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
          <init-param>
               <param-name>transformWsdlLocations</param-name>
               <param-value>true</param-value>
          </init-param>
          <init-param>
            <param-name>contextClass</param-name>
            <param-value>org.jboss.spring.vfs.context.VFSXmlWebApplicationContext</param-value>
          </init-param>
          <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:applicationContext-web.xml</param-value>
          </init-param>
     </servlet>

     <servlet-mapping>
          <servlet-name>trxservice</servlet-name>
          <url-pattern>/*</url-pattern>
     </servlet-mapping>

 

Hope this helps

Stefan

Reply to this message by going to Community

Start a new discussion in Spring Integration at Community