Skip to content

Commit e2243d9

Browse files
committed
Introduce new property for enabling HTTP/2
1 parent 7c52bb3 commit e2243d9

File tree

2 files changed

+53
-0
lines changed
  • spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web
  • spring-boot/src/main/java/org/springframework/boot/web/server

2 files changed

+53
-0
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.springframework.boot.context.properties.ConfigurationProperties;
3232
import org.springframework.boot.context.properties.NestedConfigurationProperty;
3333
import org.springframework.boot.web.server.Compression;
34+
import org.springframework.boot.web.server.Http2;
3435
import org.springframework.boot.web.server.Ssl;
3536
import org.springframework.boot.web.servlet.server.Jsp;
3637
import org.springframework.util.Assert;
@@ -50,6 +51,7 @@
5051
* @author Aurélien Leboulanger
5152
* @author Brian Clozel
5253
* @author Olivier Lamy
54+
* @author Paul Vorbach
5355
*/
5456
@ConfigurationProperties(prefix = "server", ignoreUnknownFields = true)
5557
public class ServerProperties {
@@ -102,6 +104,9 @@ public class ServerProperties {
102104
@NestedConfigurationProperty
103105
private Compression compression = new Compression();
104106

107+
@NestedConfigurationProperty
108+
private Http2 http2 = new Http2();
109+
105110
private Servlet servlet = new Servlet();
106111

107112
private final Tomcat tomcat = new Tomcat();
@@ -190,6 +195,14 @@ public Compression getCompression() {
190195
return this.compression;
191196
}
192197

198+
public Http2 getHttp2() {
199+
return http2;
200+
}
201+
202+
public void setHttp2(Http2 http2) {
203+
this.http2 = http2;
204+
}
205+
193206
public Servlet getServlet() {
194207
return this.servlet;
195208
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright 2012-2017 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.web.server;
18+
19+
/**
20+
* Simple server-independent abstraction for configuration of HTTP/2.
21+
*
22+
* @author Paul Vorbach
23+
* @since 2.0.0
24+
*/
25+
public class Http2 {
26+
27+
/**
28+
* If HTTP/2 is enabled.
29+
*/
30+
private boolean enabled = false;
31+
32+
public boolean isEnabled() {
33+
return this.enabled;
34+
}
35+
36+
public void setEnabled(boolean enabled) {
37+
this.enabled = enabled;
38+
}
39+
40+
}

0 commit comments

Comments
 (0)