由于Tomcat8以上在传递参数以及请求路径中不允许出现特殊字符,所以可以在SpringBoot的启动类中加入以下代码(不使用SpringBoot内置的tomcat也可以生效)只修改请求参数的字符规则
@SpringBootApplication
public class FunctionApplication {
public static void main(String[] args) {
SpringApplication.run(FunctionApplication.class, args);
}
@Bean
public ConfigurableServletWebServerFactory webServerFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
factory.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "\"<>[\\]^`{|}"));
return factory;
}
}