Announcement Announcement Module
No announcement yet.
MessageDispatcherServlet ApplicationContext Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • MessageDispatcherServlet ApplicationContext

    I'm having a problem that is created by the fact that my
    spring-ws servlet and my spring-mvc servlet are each creating their own ApplicationContexts. (In fact, even though I declare a bean to be scope=singleton I'm getting two of them created, one in each context).

    Also, I'd LIKE to have the spring-ws beans defined in one spring-ws-servlet.xml configuration file and the primarily mvc related beans defined in another one, e.g. spring-mvc-servlet.xml. I was able to do this by using the following:
    <listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>

    But I still have a problem related to having TWO ApplicationContexts.

    Can someone tell me how to share them so that I only have one?

    Thanks in advance!

    -- Langley

  • #2
    First of all the current way of your configuration is wrong. I suggest you read the reference guide that explains quite well the way ApplicationContexts work.

    IN your current configuration you have 3 contexts.

    1. Root ApplicationContext (loaded with the ContextLoaderListener)
    2. Web ApplicationContext (lodaed with the DispatcherServlet)
    3. WebService ApplicationContext (loaded with the MessageDispatchterServlet).

    Where 2 and 3 are pointing to 1 as the parent.

    So all the shared stuff (services/daos) should be loaded by 1. All the stuff that is specific for the Web stuff should be loaded by the Dispatcher servlet and the same goes for the web services stuff.