Skip to content

Allow @ControllerAdvice to be cofigured with a join point to target a subset of controller [SPR-10222] #14855

Closed
@spring-projects-issues

Description

@spring-projects-issues

Adib Saikali opened SPR-10222 and commented

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.


Affects: 3.2 GA, 3.2.1

Referenced from: commits c4a8bf9, cfb6625, 4f28c77

1 votes, 6 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions