Skip to content

Apply Filter or Interceptor to Controller class via annotations [SPR-13377] #17959

@spring-projects-issues

Description

@spring-projects-issues

Travis Smith opened SPR-13377 and commented

I think it would be awesome to be able to apply Filters or perhaps Interceptors as annotations. E.g.

@Controller
public class DefaultController {
    @RequestMapping("/")
    @ResponseBody
    String home() {
        return "Hello World!";
    }
}

And we want to apply some specific, custom authentication to that controller or request handlers.

@Controller
@MyAuthenticationFilter
public class DefaultController {
    @RequestMapping("/")
    @ResponseBody
    String home() {
        return "Hello World!";
    }
}

Or maybe @Filter(MyAuthenticationFilter.class) could work as well.


Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions