unnik
unnik

Reputation: 1153

Spring REST mandatory @RequestParam for all the API

Is there a way to configure @RequestParam for all the API in a class. I want all my API to have a mantory request param like token.

Upvotes: 1

Views: 246

Answers (1)

Dovmo
Dovmo

Reputation: 8749

Have you seen the @RequestMapping#params annotation element?

@RequestMapping is an annotation that you can put on the top of your controller and then you can provide the required parameter names that need to be present for it to be accessible on your controller:

@RequestMapping(params = { "token" }, ...)
public class MyRequiredTokenEndpoints { ... }

Upvotes: 2

Related Questions