springboot2.3.1 tomcat设置特殊字符入参

最近遇到一个问题,在请求中,参数传了json串,请求会报错

The valid characters are defined in RFC 7230 and RFC 3986
    @Bean
    public TomcatServletWebServerFactory webServerFactory() {

          TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();

          factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {

                            @Override

                            public void customize(Connector connector) {

                                   connector.setProperty("relaxedPathChars", "\"<>[\\]^`{|}");

                                   connector.setProperty("relaxedQueryChars", "\"<>[\\]^`{|}");

                             }

            });

            return factory;

    }

 

你可能感兴趣的:(springboot)