I have multiple rest endpoints. userId (http header) is common in all endpoints. I want to apply a logic, let say set its default value if not provided or trim it if is provided in request before request enters the method (for eg: heartbeat). How can we achieve this in spring boot rest mvc.
@RestController public class MyResource { @RequestMapping(value = "/heartbeat", method= RequestMethod.GET) public String heartbeat (@RequestHeader (value="userId", required=false) String userId) { ... } }