Spring 引导:REST API 行为不一致 post 版本升级

Spring boot : REST API behaviour inconsistent post version upgrade

从 1.5.10.RELEASE 升级到 Spring Boot 2.3.0.RELEASE 后出现问题。我们的控制器 API 看起来像 -

@RequestMapping(value = "/card", method = RequestMethod.GET)
public CardRespDTO getCards(@RequestParam String profileId, @RequestParam(required = false) String banner, @RequestParam(required = false) String paymentGatewayVersion);

消费者可以通过不传递 profileId 参数而只提供一些 USER_ID header 来调用此 API。但是 post 版本升级,这些调用失败并出现以下错误 -

org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'profileId' is not present

有人可以帮忙找出这里的问题吗?我们不能要求消费者做出改变。

profileId 标记为不需要应该可以解决问题:

@RequestMapping(value = "/card", method = RequestMethod.GET)
public CardRespDTO getCards(@RequestParam(required = false) String profileId, 
    @RequestParam(required = false) String banner, 
    @RequestParam(required = false) String paymentGatewayVersion)