In my case, Spring was intercepting the request before it reached my controller method, which caused the validation to not work as expected. By default, the @RequestParam annotation has the required attribute set to true, meaning Spring would reject the request if the parameter was missing. To resolve this, I set required = false in the @RequestParam annotation. This allowed the request to reach my controller method, where the validation could be properly applied.