Apply ConfigurationPropertySource where possible

See gh-18366
This commit is contained in:
Stéphane Nicoll
2025-05-13 13:16:32 +02:00
parent b3f35baed3
commit d8a9db534f
9 changed files with 109 additions and 371 deletions

View File

@@ -2105,92 +2105,6 @@
"level": "error"
}
},
{
"name": "management.server.ssl.bundle",
"description": "Name of a configured SSL bundle."
},
{
"name": "management.server.ssl.certificate",
"description": "Path to a PEM-encoded SSL certificate file."
},
{
"name": "management.server.ssl.certificate-private-key",
"description": "Path to a PEM-encoded private key file for the SSL certificate."
},
{
"name": "management.server.ssl.ciphers",
"description": "Supported SSL ciphers."
},
{
"name": "management.server.ssl.client-auth",
"description": "Client authentication mode. Requires a trust store."
},
{
"name": "management.server.ssl.enabled",
"description": "Whether to enable SSL support.",
"defaultValue": true
},
{
"name": "management.server.ssl.enabled-protocols",
"description": "Enabled SSL protocols."
},
{
"name": "management.server.ssl.key-alias",
"description": "Alias that identifies the key in the key store."
},
{
"name": "management.server.ssl.key-password",
"description": "Password used to access the key in the key store."
},
{
"name": "management.server.ssl.key-store",
"description": "Path to the key store that holds the SSL certificate (typically a jks file)."
},
{
"name": "management.server.ssl.key-store-password",
"description": "Password used to access the key store."
},
{
"name": "management.server.ssl.key-store-provider",
"description": "Provider for the key store."
},
{
"name": "management.server.ssl.key-store-type",
"description": "Type of the key store."
},
{
"name": "management.server.ssl.protocol",
"description": "SSL protocol to use.",
"defaultValue": "TLS"
},
{
"name": "management.server.ssl.server-name-bundles",
"description": "Mapping of host names to SSL bundles for SNI configuration."
},
{
"name": "management.server.ssl.trust-certificate",
"description": "Path to a PEM-encoded SSL certificate authority file."
},
{
"name": "management.server.ssl.trust-certificate-private-key",
"description": "Path to a PEM-encoded private key file for the SSL certificate authority."
},
{
"name": "management.server.ssl.trust-store",
"description": "Trust store that holds SSL certificates."
},
{
"name": "management.server.ssl.trust-store-password",
"description": "Password used to access the trust store."
},
{
"name": "management.server.ssl.trust-store-provider",
"description": "Provider for the trust store."
},
{
"name": "management.server.ssl.trust-store-type",
"description": "Type of the trust store."
},
{
"name": "management.trace.http.enabled",
"deprecation": {

View File

@@ -1,34 +1,6 @@
{
"groups": [],
"properties": [
{
"name": "server.compression.enabled",
"description": "Whether response compression is enabled.",
"defaultValue": false
},
{
"name": "server.compression.excluded-user-agents",
"description": "Comma-separated list of user agents for which responses should not be compressed."
},
{
"name": "server.compression.mime-types",
"description": "Comma-separated list of MIME types that should be compressed.",
"defaultValue": [
"text/html",
"text/xml",
"text/plain",
"text/css",
"text/javascript",
"application/javascript",
"application/json",
"application/xml"
]
},
{
"name": "server.compression.min-response-size",
"description": "Minimum \"Content-Length\" value that is required for compression to be performed.",
"defaultValue": "2KB"
},
{
"name": "server.connection-timeout",
"type": "java.time.Duration",
@@ -37,11 +9,6 @@
"level": "error"
}
},
{
"name": "server.http2.enabled",
"description": "Whether to enable HTTP/2 support, if the current environment supports it.",
"defaultValue": false
},
{
"name": "server.jetty.accesslog.date-format",
"deprecation": {
@@ -159,33 +126,12 @@
"name": "server.reactive.session.cookie.secure",
"description": "Whether to always mark the cookie as secure."
},
{
"name": "server.servlet.encoding.charset",
"description": "Charset of HTTP requests and responses. Added to the \"Content-Type\" header if not set explicitly.",
"defaultValue": "UTF-8"
},
{
"name": "server.servlet.encoding.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable http encoding support.",
"defaultValue": true
},
{
"name": "server.servlet.encoding.force",
"description": "Whether to force the encoding to the configured charset on HTTP requests and responses."
},
{
"name": "server.servlet.encoding.force-request",
"description": "Whether to force the encoding to the configured charset on HTTP requests. Defaults to true when \"force\" has not been specified."
},
{
"name": "server.servlet.encoding.force-response",
"description": "Whether to force the encoding to the configured charset on HTTP responses."
},
{
"name": "server.servlet.encoding.mapping",
"description": "Mapping of locale to charset for response encoding."
},
{
"name": "server.servlet.jsp.class-name",
"description": "Class name of the servlet to use for JSPs. If registered is true and this class\n\t * is on the classpath then it will be registered.",
@@ -195,11 +141,6 @@
"name": "server.servlet.jsp.init-parameters",
"description": "Init parameters used to configure the JSP servlet."
},
{
"name": "server.servlet.jsp.registered",
"description": "Whether the JSP servlet is registered.",
"defaultValue": true
},
{
"name": "server.servlet.path",
"type": "java.lang.String",
@@ -217,142 +158,6 @@
"level": "error"
}
},
{
"name": "server.servlet.session.cookie.domain",
"description": "Domain for the cookie."
},
{
"name": "server.servlet.session.cookie.http-only",
"description": "Whether to use \"HttpOnly\" cookies for the cookie."
},
{
"name": "server.servlet.session.cookie.max-age",
"description": "Maximum age of the cookie. If a duration suffix is not specified, seconds will be used. A positive value indicates when the cookie expires relative to the current time. A value of 0 means the cookie should expire immediately. A negative value means no \"Max-Age\"."
},
{
"name": "server.servlet.session.cookie.name",
"description": "Name of the cookie."
},
{
"name": "server.servlet.session.cookie.partitioned",
"description": "Whether the generated cookie carries the Partitioned attribute."
},
{
"name": "server.servlet.session.cookie.path",
"description": "Path of the cookie."
},
{
"name": "server.servlet.session.cookie.same-site",
"description": "SameSite setting for the cookie."
},
{
"name": "server.servlet.session.cookie.secure",
"description": "Whether to always mark the cookie as secure."
},
{
"name": "server.servlet.session.persistent",
"description": "Whether to persist session data between restarts.",
"defaultValue": false
},
{
"name": "server.servlet.session.store-dir",
"description": "Directory used to store session data."
},
{
"name": "server.servlet.session.timeout",
"description": "Session timeout. If a duration suffix is not specified, seconds will be used.",
"defaultValue": "30m"
},
{
"name": "server.servlet.session.tracking-modes",
"description": "Session tracking modes."
},
{
"name": "server.ssl.bundle",
"description": "Name of a configured SSL bundle."
},
{
"name": "server.ssl.certificate",
"description": "Path to a PEM-encoded SSL certificate file."
},
{
"name": "server.ssl.certificate-private-key",
"description": "Path to a PEM-encoded private key file for the SSL certificate."
},
{
"name": "server.ssl.ciphers",
"description": "Supported SSL ciphers."
},
{
"name": "server.ssl.client-auth",
"description": "Client authentication mode. Requires a trust store."
},
{
"name": "server.ssl.enabled",
"description": "Whether to enable SSL support.",
"defaultValue": true
},
{
"name": "server.ssl.enabled-protocols",
"description": "Enabled SSL protocols."
},
{
"name": "server.ssl.key-alias",
"description": "Alias that identifies the key in the key store."
},
{
"name": "server.ssl.key-password",
"description": "Password used to access the key in the key store."
},
{
"name": "server.ssl.key-store",
"description": "Path to the key store that holds the SSL certificate (typically a jks file)."
},
{
"name": "server.ssl.key-store-password",
"description": "Password used to access the key store."
},
{
"name": "server.ssl.key-store-provider",
"description": "Provider for the key store."
},
{
"name": "server.ssl.key-store-type",
"description": "Type of the key store."
},
{
"name": "server.ssl.protocol",
"description": "SSL protocol to use.",
"defaultValue": "TLS"
},
{
"name": "server.ssl.server-name-bundles",
"description": "Mapping of host names to SSL bundles for SNI configuration."
},
{
"name": "server.ssl.trust-certificate",
"description": "Path to a PEM-encoded SSL certificate authority file."
},
{
"name": "server.ssl.trust-certificate-private-key",
"description": "Path to a PEM-encoded private key file for the SSL certificate authority."
},
{
"name": "server.ssl.trust-store",
"description": "Trust store that holds SSL certificates."
},
{
"name": "server.ssl.trust-store-password",
"description": "Password used to access the trust store."
},
{
"name": "server.ssl.trust-store-provider",
"description": "Provider for the trust store."
},
{
"name": "server.ssl.trust-store-type",
"description": "Type of the trust store."
},
{
"name": "server.tomcat.max-http-post-size",
"type": "org.springframework.util.unit.DataSize",
@@ -2698,92 +2503,6 @@
"level": "error"
}
},
{
"name": "spring.rsocket.server.ssl.bundle",
"description": "Name of a configured SSL bundle."
},
{
"name": "spring.rsocket.server.ssl.certificate",
"description": "Path to a PEM-encoded SSL certificate file."
},
{
"name": "spring.rsocket.server.ssl.certificate-private-key",
"description": "Path to a PEM-encoded private key file for the SSL certificate."
},
{
"name": "spring.rsocket.server.ssl.ciphers",
"description": "Supported SSL ciphers."
},
{
"name": "spring.rsocket.server.ssl.client-auth",
"description": "Client authentication mode. Requires a trust store."
},
{
"name": "spring.rsocket.server.ssl.enabled",
"description": "Whether to enable SSL support.",
"defaultValue": true
},
{
"name": "spring.rsocket.server.ssl.enabled-protocols",
"description": "Enabled SSL protocols."
},
{
"name": "spring.rsocket.server.ssl.key-alias",
"description": "Alias that identifies the key in the key store."
},
{
"name": "spring.rsocket.server.ssl.key-password",
"description": "Password used to access the key in the key store."
},
{
"name": "spring.rsocket.server.ssl.key-store",
"description": "Path to the key store that holds the SSL certificate (typically a jks file)."
},
{
"name": "spring.rsocket.server.ssl.key-store-password",
"description": "Password used to access the key store."
},
{
"name": "spring.rsocket.server.ssl.key-store-provider",
"description": "Provider for the key store."
},
{
"name": "spring.rsocket.server.ssl.key-store-type",
"description": "Type of the key store."
},
{
"name": "spring.rsocket.server.ssl.protocol",
"description": "SSL protocol to use.",
"defaultValue": "TLS"
},
{
"name": "spring.rsocket.server.ssl.server-name-bundles",
"description": "Mapping of host names to SSL bundles for SNI configuration."
},
{
"name": "spring.rsocket.server.ssl.trust-certificate",
"description": "Path to a PEM-encoded SSL certificate authority file."
},
{
"name": "spring.rsocket.server.ssl.trust-certificate-private-key",
"description": "Path to a PEM-encoded private key file for the SSL certificate authority."
},
{
"name": "spring.rsocket.server.ssl.trust-store",
"description": "Trust store that holds SSL certificates."
},
{
"name": "spring.rsocket.server.ssl.trust-store-password",
"description": "Password used to access the trust store."
},
{
"name": "spring.rsocket.server.ssl.trust-store-provider",
"description": "Provider for the trust store."
},
{
"name": "spring.rsocket.server.ssl.trust-store-type",
"description": "Type of the trust store."
},
{
"name": "spring.security.filter.dispatcher-types",
"defaultValue": [

View File

@@ -16,6 +16,7 @@
package org.springframework.boot.web.server;
import org.springframework.boot.context.properties.ConfigurationPropertiesSource;
import org.springframework.util.unit.DataSize;
/**
@@ -26,15 +27,28 @@ import org.springframework.util.unit.DataSize;
* @author Stephane Nicoll
* @since 2.0.0
*/
@ConfigurationPropertiesSource
public class Compression {
/**
* Whether response compression is enabled.
*/
private boolean enabled;
/**
* Comma-separated list of MIME types that should be compressed.
*/
private String[] mimeTypes = new String[] { "text/html", "text/xml", "text/plain", "text/css", "text/javascript",
"application/javascript", "application/json", "application/xml" };
/**
* Comma-separated list of user agents for which responses should not be compressed.
*/
private String[] excludedUserAgents = null;
/**
* Minimum "Content-Length" value that is required for compression to be performed.
*/
private DataSize minResponseSize = DataSize.ofKilobytes(2);
/**

View File

@@ -19,6 +19,7 @@ package org.springframework.boot.web.server;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import org.springframework.boot.context.properties.ConfigurationPropertiesSource;
import org.springframework.boot.convert.DurationUnit;
/**
@@ -30,6 +31,7 @@ import org.springframework.boot.convert.DurationUnit;
* @author Weix Sun
* @since 2.6.0
*/
@ConfigurationPropertiesSource
public class Cookie {
/**

View File

@@ -16,14 +16,20 @@
package org.springframework.boot.web.server;
import org.springframework.boot.context.properties.ConfigurationPropertiesSource;
/**
* Simple server-independent abstraction for HTTP/2 configuration.
*
* @author Brian Clozel
* @since 2.0.0
*/
@ConfigurationPropertiesSource
public class Http2 {
/**
* Whether to enable HTTP/2 support, if the current environment supports it.
*/
private boolean enabled;
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@ package org.springframework.boot.web.server;
import java.util.ArrayList;
import java.util.List;
import org.springframework.boot.context.properties.ConfigurationPropertiesSource;
/**
* Simple server-independent abstraction for SSL configuration.
*
@@ -28,48 +30,112 @@ import java.util.List;
* @author Scott Frederick
* @since 2.0.0
*/
@ConfigurationPropertiesSource
public class Ssl {
/**
* Whether to enable SSL support.
*/
private boolean enabled = true;
/**
* Name of a configured SSL bundle.
*/
private String bundle;
/**
* Client authentication mode. Requires a trust store.
*/
private ClientAuth clientAuth;
/**
* Supported SSL ciphers.
*/
private String[] ciphers;
/**
* Enabled SSL protocols.
*/
private String[] enabledProtocols;
/**
* Alias that identifies the key in the key store.
*/
private String keyAlias;
/**
* Password used to access the key in the key store.
*/
private String keyPassword;
/**
* Path to the key store that holds the SSL certificate (typically a jks file).
*/
private String keyStore;
/**
* Password used to access the key store.
*/
private String keyStorePassword;
/**
* Type of the key store.
*/
private String keyStoreType;
/**
* Provider for the key store.
*/
private String keyStoreProvider;
/**
* Trust store that holds SSL certificates.
*/
private String trustStore;
/**
* Password used to access the trust store.
*/
private String trustStorePassword;
/**
* Type of the trust store.
*/
private String trustStoreType;
/**
* Provider for the trust store.
*/
private String trustStoreProvider;
/**
* Path to a PEM-encoded SSL certificate file.
*/
private String certificate;
/**
* Path to a PEM-encoded private key file for the SSL certificate.
*/
private String certificatePrivateKey;
/**
* Path to a PEM-encoded SSL certificate authority file.
*/
private String trustCertificate;
/**
* Path to a PEM-encoded private key file for the SSL certificate authority.
*/
private String trustCertificatePrivateKey;
/**
* SSL protocol to use.
*/
private String protocol = "TLS";
/**
* Mapping of host names to SSL bundles for SNI configuration.
*/
private List<ServerNameSslBundle> serverNameBundles = new ArrayList<>();
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@ import java.nio.charset.StandardCharsets;
import java.util.Locale;
import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationPropertiesSource;
/**
* Configuration properties for server HTTP encoding.
*
@@ -29,6 +31,7 @@ import java.util.Map;
* @author Brian Clozel
* @since 2.3.0
*/
@ConfigurationPropertiesSource
public class Encoding {
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@ package org.springframework.boot.web.servlet.server;
import java.util.HashMap;
import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationPropertiesSource;
/**
* Configuration for the server's JSP servlet.
*
@@ -26,6 +28,7 @@ import java.util.Map;
* @author Stephane Nicoll
* @since 2.0.0
*/
@ConfigurationPropertiesSource
public class Jsp {
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.Set;
import org.springframework.boot.context.properties.ConfigurationPropertiesSource;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import org.springframework.boot.convert.DurationUnit;
@@ -30,13 +31,23 @@ import org.springframework.boot.convert.DurationUnit;
* @author Andy Wilkinson
* @since 2.0.0
*/
@ConfigurationPropertiesSource
public class Session {
/**
* Session timeout. If a duration suffix is not specified, seconds will be used.
*/
@DurationUnit(ChronoUnit.SECONDS)
private Duration timeout = Duration.ofMinutes(30);
/**
* Session tracking modes.
*/
private Set<Session.SessionTrackingMode> trackingModes;
/**
* Whether to persist session data between restarts.
*/
private boolean persistent;
/**