springboot解决The valid characters are defined in RFC 7230 and RFC 3986

代码:

@Configuration
public class ServerConfig {

    @Bean
    public ConfigurableServletWebServerFactory webServerFactory() {
        TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
        factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
            @Override
            public void customize(Connector connector) {
                connector.setProperty("relaxedQueryChars", "|{}[]");//允许的特殊字符
            }
        });
        return factory;
    }
}

你可能感兴趣的:(springboot)