解决报错:
Invalid character found in the request target. The valid characters are defined in RFC****
代码语言:javascript复制 //2.x
@Bean
public ConfigurableServletWebServerFactory webServerFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
factory.addConnectorCustomizers((TomcatConnectorCustomizer) connector ->
connector.setProperty("relaxedQueryChars", "|{}[]"));
return factory;
}
//1.x
@Bean
public EmbeddedServletContainerFactory webServerFactory() {
TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
factory.addConnectorCustomizers(
(TomcatConnectorCustomizer) connector ->
connector.setProperty("relaxedQueryChars", "|{}[]"));
return factory;
}