Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-3297

Bean refresh in the DispatcherServlet

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.3
    • Fix Version/s: 2.0.4
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      When running a web application using Spring MVC, it's not possible to effectively refresh the web-tier application context. For example, when running a webflow application, the web-tier application context has a bean definition for a FlowRegistry. This registry reads a set of files from the filesystem based on wild-card patterns. If a new file is added, I'd like to read that file and use it without restarting the servlet. From a context perspective this is possible. A refresh of the context (via JMX for example) will reinstantiate the registry bean and read the new file in if it matches the selection pattern.

      The problem lies in the DispatcherServlet. The DispatcherServlet maintains a cached reference to the HandlerMapping that it was started with. Therefore, even though the context has been refreshed and all beans recreated, the HandlerMapping is the original HandlerMapping bean and it may contain cached references to the original handlers and on through the object graph.

      The DispatcherServlet should have a mechanism to reload HandlerMappings (or really any artifacts) from a refreshed web-tier application context.

        Attachments

          Activity

            People

            • Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              nebhale nebhale
              Last updater:
              Trevor Marshall
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                11 years, 13 weeks, 4 days ago