springboot2.1.5 项目配置内置tomcat使用Http11AprProtocol

springboot2.1.5 项目配置内置tomcat使用Http11AprProtocol

通过TomcatServletWebServerFactory类中setProtocol()方法即可

/**
 * 

@filename SSLAPRConfig

*

*

@description apr配置类

* * @author llspace * @version 1.0 * @since 2019/6/25 18:01 **/ @Configuration public class AprProtocolConfig { @Bean public TomcatServletWebServerFactory servletContainer() { TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory(); tomcat.setProtocol("org.apache.coyote.http11.Http11AprProtocol"); tomcat.addContextLifecycleListeners(new AprLifecycleListener()); return tomcat; } }

Http11AprProtocol需要tcnative-1.dll支持, 内置tomcat版本是9,下载对应tomcat包,将bin目录下的tcnative-1.dll拷贝到jdk安装目录的bin目录下

启动测试,看到如下打印即配置成功了

o.a.coyote.http11.Http11AprProtocol : Starting ProtocolHandler [“http-apr-443”]

你可能感兴趣的:(spring,boot)