Springboot2 Tomcat自定义配置
所属分类 springboot
浏览量 954
private class MyTomcatConnectorCustomizer implements TomcatConnectorCustomizer {
@Override
public void customize(Connector connector) {
Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
protocol.setAcceptCount(333);
protocol.setAcceptorThreadCount(2);
protocol.setMaxThreads(99);
protocol.setMinSpareThreads(7);
protocol.setMaxConnections(999);
protocol.setConnectionTimeout(19000);
}
}
@Bean
public ConfigurableServletWebServerFactory createEmbeddedServletContainerFactory() {
TomcatServletWebServerFactory tomcatFactory = new TomcatServletWebServerFactory();
// tomcatFactory.setPort(8090);
tomcatFactory.addConnectorCustomizers(new MyTomcatConnectorCustomizer());
return tomcatFactory;
}
完整代码
https://gitee.com/dyyx/springboothello/blob/master/src/main/java/demo/config/TomcatConfig.java
上一篇
下一篇
Synchronized 和 AQS 实现要点
java死锁实例
SpringBoot启动过程简介
springboot2 FileEncodingApplicationListener简介
maven jar包冲突处理
aerospike 某客户 stop-write 实例