spring boot中使用Map<String, String>封装请求参数

我正在将我的spring boot应用程序从1.5.x迁移到2.3.x。在更新了所需的依赖关系后,在有以下方法的控制器中,得到一个错误。

@RequestMapping(value= "/test", method = RequestMethod.POST)
public ResponseEntity<MyResult> getTestRes(
                                       @RequestParam("test1") final String test1,
                                       @RequestParam("test2") final String test2,
                                       @RequestParam("test3") final String test3,
                                       @RequestParam Map<String, String> reqParam,
                                       final HttpServeletRequest req) throws Exception {

        //method body.....
}

当我试图构建应用程序时,我得到以下错误。

[ERROR] Cant use non-primitive type: java.util.Map<java.lang.String, java.lang.String> as request parameter.

我使用的是Spring boot 2.3.9.RELEASE版本和Spring框架5.2.13.RELEASE。

请让我知道如何解决这个问题。

谢谢


StackOverflow:java - Map<String, String> as request parameter in spring boot application - Stack Overflow