Springboot:控制器中的@RequestParam 读取带有“&”和“#”的请求为空

Abh*_*bhi 2 java spring spring-mvc urlencode spring-boot

我有一个在Tomcat上运行的Spring-Boot应用程序。在其中,我有一个带有请求参数的RestController。不读取或作为查询参数传递。例如,如果我给出,则控制器方法不会作为值@RequestParam'&''#'
http://localhost:8080/v1/test?query=&&

@RequestMapping(value = "/v1/test", method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
     public String getV2LocationByName(
                                      @RequestParam
                                      String cityName cityName,
                                      @RequestParam(value = LANGUAGE, defaultValue = US_ENGLISH_LOCALE) String language,
                                      HttpServletRequest request) throws InterruptedException, ExecutionException {
--------------
---------------
 System.out.println(cityName);
}
Run Code Online (Sandbox Code Playgroud)

上面的程序为 & 和 # 返回空输出

为什么 spring 限制这些特殊字符,但不限制任何其他特殊字符?并且如果使用查询参数为 'Andaman&Nicobar',则查询参数被读取为 'Andaman'