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

Allow @ControllerAdvice to be cofigured with a join point to target a subset of controller

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 3.2 GA, 3.2.1
    • Fix Version/s: 4.0 RC1
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      I have two types of controllers in my spring application.

      • View controllers that forward to views to generate HTML
      • API controllers that return JSON directly from the controllers

      Both the API and View controllers are part of the same spring dispatcher servlet.

      The documentation implies that @ControllerAdvice will be applied to every controller associated with a Dispatcher Servlet. With advice as part of the name I expected to be able to specify the pointcut and or join points that the advice applies to, but can't find out how that can be.

      For example in my scenario I want a @ControllerAdvice for my View Controllers and separate @ControllerAdvice for my API controllers.

      It would be great to provide a way to configure which controllers @ControllerAdvice will apply to.

        Attachments

          Activity

            People

            • Assignee:
              bclozel Brian Clozel
              Reporter:
              asaikali Adib Saikali
              Last updater:
              Phil Webb
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                4 years, 32 weeks, 2 days ago