简体   繁体   English

在Spring Boot中为Undertow启用HTTP 2.0

[英]Enable HTTP 2.0 for Undertow in Spring Boot

I wonder how I can enable the HTTP 2.0 for Undertow using Spring Boot, I monitored the protocol and currently HTTPS is using 1.1. 我不知道如何使用Spring Boot为Undertow启用HTTP 2.0,我监视了协议,并且当前HTTPS正在使用1.1。

Is there any property for it? 有什么用吗? Or should I create a EmbeddedServletContainerFactory with this option. 还是应该使用此选项创建EmbeddedServletContainerFactory。

Tks, ks

You need to add the following bean to the configuration 您需要将以下bean添加到配置中

    @Bean
    UndertowEmbeddedServletContainerFactory embeddedServletContainerFactory() {
        UndertowEmbeddedServletContainerFactory factory = new UndertowEmbeddedServletContainerFactory();
        factory.addBuilderCustomizers(
                builder -> builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
        return factory;
    }

Then start the application with alpn-boot-8.1.9.v20160720.jar in the boot class path 然后在启动类路径中使用alpn-boot-8.1.9.v20160720.jar启动应用程序

java -Xbootclasspath/p:<<location>>/alpn-boot-8.1.9.v20160720.jar -jar <<your application>>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM