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

Improve documentation on component-scan using a ContextLoaderListener and DispatcherServlet


    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Waiting for Triage
    • Component/s: [Documentation]
    • Labels:


      Since the introduction of <context:component-scan /> I answer more and more question on issues regarding transactions and proxying in general. Mostly due to the fact that tx:annotation-driven is configured in the root ApplicationContext and that context:component-scan is defined in both the root as well as the servlet ApplicationContext. This results in 2 instances of a @Service/@Repository being available.

      A hint/example in the web chapter of the reference guide would help here on how to configure the context:component-scan in such a case.
      1. only scan @Controller in the servlet and everything but @Controller in the root.
      2. Configure mvc to look for @Controller in the root context, leaving the servlet context almost clean.

      either way should work, although I guess that option 1 is the preffered way.


        There are no comments yet on this issue.


          • Assignee:
            mdeinum Marten Deinum
            Last updater:
            Chris Beams
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created:
              Days since last comment:
              7 years, 51 weeks ago