方式3.1 springboot内置tomcat容器配置@SpringBootApplication
public class XxxApplication {
public static void main(String[] args) {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
SpringApplication.run(XxxApplication.class, args);
}
@Bean
public ConfigurableServletWebServerFactory webServerFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
@Override
public void customize(Connector connector) {
// 放开某些字符(反斜杠)限制
connector.setProperty("relaxedQueryChars", "\\");
}
});
return factory;
}
}