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

Improve documentation on component-scan using a ContextLoaderListener and DispatcherServlet

    Details

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

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Days since last comment:
                8 years, 12 weeks, 4 days ago