Create spring-boot-http-codec module
This commit is contained in:
committed by
Phillip Webb
parent
4ce8b591e0
commit
2e52a3ebef
@@ -78,6 +78,7 @@ include "spring-boot-project:spring-boot-h2console"
|
||||
include "spring-boot-project:spring-boot-hateoas"
|
||||
include "spring-boot-project:spring-boot-hazelcast"
|
||||
include "spring-boot-project:spring-boot-http"
|
||||
include "spring-boot-project:spring-boot-http-codec"
|
||||
include "spring-boot-project:spring-boot-integration"
|
||||
include "spring-boot-project:spring-boot-jackson"
|
||||
include "spring-boot-project:spring-boot-jdbc"
|
||||
|
||||
@@ -42,6 +42,7 @@ dependencies {
|
||||
optional(project(":spring-boot-project:spring-boot-flyway"))
|
||||
optional(project(":spring-boot-project:spring-boot-hazelcast"))
|
||||
optional(project(":spring-boot-project:spring-boot-http"))
|
||||
optional(project(":spring-boot-project:spring-boot-http-codec"))
|
||||
optional(project(":spring-boot-project:spring-boot-integration"))
|
||||
optional(project(":spring-boot-project:spring-boot-jackson"))
|
||||
optional(project(":spring-boot-project:spring-boot-jdbc"))
|
||||
|
||||
@@ -24,9 +24,9 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfi
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration;
|
||||
import org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.reactor.netty.autoconfigure.NettyReactiveWebServerAutoConfiguration;
|
||||
import org.springframework.boot.test.context.assertj.AssertableReactiveWebApplicationContext;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2023 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.
|
||||
@@ -26,9 +26,9 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAu
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.web.reactive.WebFluxEndpointManagementContextConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration;
|
||||
import org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.test.context.runner.ContextConsumer;
|
||||
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
|
||||
|
||||
@@ -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.
|
||||
@@ -25,9 +25,9 @@ import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfi
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration;
|
||||
import org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
@@ -24,9 +24,9 @@ import org.springframework.boot.actuate.autoconfigure.system.DiskSpaceHealthCont
|
||||
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.web.server.netty.NettyReactiveManagementContextAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration;
|
||||
import org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.reactor.netty.autoconfigure.NettyReactiveWebServerAutoConfiguration;
|
||||
import org.springframework.boot.test.context.assertj.AssertableReactiveWebApplicationContext;
|
||||
|
||||
@@ -110,6 +110,7 @@ dependencies {
|
||||
testImplementation("org.glassfish.jersey.media:jersey-media-json-jackson")
|
||||
testImplementation("com.squareup.okhttp3:mockwebserver")
|
||||
|
||||
testRuntimeOnly(project(":spring-boot-project:spring-boot-http-codec"))
|
||||
testRuntimeOnly("ch.qos.logback:logback-classic")
|
||||
testRuntimeOnly("io.projectreactor.netty:reactor-netty-http")
|
||||
testRuntimeOnly("jakarta.xml.bind:jakarta.xml.bind-api")
|
||||
|
||||
@@ -47,6 +47,7 @@ dependencies {
|
||||
optional(project(":spring-boot-project:spring-boot-h2console"))
|
||||
optional(project(":spring-boot-project:spring-boot-hazelcast"))
|
||||
optional(project(":spring-boot-project:spring-boot-http"))
|
||||
optional(project(":spring-boot-project:spring-boot-http-codec"))
|
||||
optional(project(":spring-boot-project:spring-boot-jackson"))
|
||||
optional(project(":spring-boot-project:spring-boot-jdbc"))
|
||||
optional(project(":spring-boot-project:spring-boot-jsonb"))
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.codec;
|
||||
|
||||
import org.springframework.boot.autoconfigure.http.codec.HttpCodecsProperties;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
|
||||
import org.springframework.util.unit.DataSize;
|
||||
|
||||
/**
|
||||
* {@link ConfigurationProperties Properties} for reactive codecs.
|
||||
*
|
||||
* @author Brian Clozel
|
||||
* @since 2.2.1
|
||||
* @deprecated since 3.5.0 for removal in 4.0.0 in favor of {@link HttpCodecsProperties}
|
||||
*/
|
||||
@ConfigurationProperties("spring.codec")
|
||||
@Deprecated(since = "3.5.0", forRemoval = true)
|
||||
public class CodecProperties {
|
||||
|
||||
/**
|
||||
* Whether to log form data at DEBUG level, and headers at TRACE level.
|
||||
*/
|
||||
private boolean logRequestDetails;
|
||||
|
||||
/**
|
||||
* Limit on the number of bytes that can be buffered whenever the input stream needs
|
||||
* to be aggregated. This applies only to the auto-configured WebFlux server and
|
||||
* WebClient instances. By default this is not set, in which case individual codec
|
||||
* defaults apply. Most codecs are limited to 256K by default.
|
||||
*/
|
||||
private DataSize maxInMemorySize;
|
||||
|
||||
@DeprecatedConfigurationProperty(since = "3.5.0", replacement = "spring.http.codecs.log-request-details")
|
||||
public boolean isLogRequestDetails() {
|
||||
return this.logRequestDetails;
|
||||
}
|
||||
|
||||
public void setLogRequestDetails(boolean logRequestDetails) {
|
||||
this.logRequestDetails = logRequestDetails;
|
||||
}
|
||||
|
||||
@DeprecatedConfigurationProperty(since = "3.5.0", replacement = "spring.http.codecs.max-in-memory-size")
|
||||
public DataSize getMaxInMemorySize() {
|
||||
return this.maxInMemorySize;
|
||||
}
|
||||
|
||||
public void setMaxInMemorySize(DataSize maxInMemorySize) {
|
||||
this.maxInMemorySize = maxInMemorySize;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Auto-configuration for reactive codecs.
|
||||
*/
|
||||
package org.springframework.boot.autoconfigure.codec;
|
||||
@@ -32,7 +32,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProp
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProviders;
|
||||
import org.springframework.boot.autoconfigure.thread.Threading;
|
||||
@@ -105,10 +104,9 @@ import org.springframework.web.server.session.WebSessionManager;
|
||||
* @author Weix Sun
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration(
|
||||
after = { CodecsAutoConfiguration.class, ReactiveMultipartAutoConfiguration.class,
|
||||
WebSessionIdResolverAutoConfiguration.class },
|
||||
afterName = "org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration")
|
||||
@AutoConfiguration(after = { ReactiveMultipartAutoConfiguration.class, WebSessionIdResolverAutoConfiguration.class },
|
||||
afterName = { "org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration",
|
||||
"org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration" })
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
|
||||
@ConditionalOnClass(WebFluxConfigurer.class)
|
||||
@ConditionalOnMissingBean({ WebFluxConfigurationSupport.class })
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.http.client.reactive.ClientHttpConnectorAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.http.client.reactive.ClientHttpConnectorBuilder;
|
||||
import org.springframework.boot.http.client.reactive.ClientHttpConnectorSettings;
|
||||
import org.springframework.boot.ssl.SslBundles;
|
||||
@@ -50,7 +49,8 @@ import org.springframework.web.reactive.function.client.WebClient;
|
||||
* @author Phillip Webb
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration(after = { CodecsAutoConfiguration.class, ClientHttpConnectorAutoConfiguration.class })
|
||||
@AutoConfiguration(after = ClientHttpConnectorAutoConfiguration.class,
|
||||
afterName = "org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration")
|
||||
@ConditionalOnClass(WebClient.class)
|
||||
public class WebClientAutoConfiguration {
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ org.springframework.boot.autoconfigure.http.client.HttpClientAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.http.client.service.HttpServiceClientAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.http.client.reactive.ClientHttpConnectorAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.http.client.reactive.service.ReactiveHttpServiceClientAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.netty.NettyAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.reactor.ReactorAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.session.SessionAutoConfiguration
|
||||
|
||||
@@ -30,9 +30,9 @@ import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.graphql.GraphQlTestDataFetchers;
|
||||
import org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration;
|
||||
import org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
|
||||
import org.springframework.boot.testsupport.classpath.resources.WithResource;
|
||||
|
||||
@@ -29,9 +29,9 @@ import org.springframework.boot.autoconfigure.graphql.Book;
|
||||
import org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.graphql.GraphQlTestDataFetchers;
|
||||
import org.springframework.boot.autoconfigure.graphql.reactive.GraphQlWebFluxAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration;
|
||||
import org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.security.autoconfigure.reactive.ReactiveSecurityAutoConfiguration;
|
||||
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
|
||||
|
||||
@@ -2011,6 +2011,7 @@ bom {
|
||||
"spring-boot-hateoas",
|
||||
"spring-boot-hazelcast",
|
||||
"spring-boot-http",
|
||||
"spring-boot-http-codec",
|
||||
"spring-boot-integration",
|
||||
"spring-boot-jackson",
|
||||
"spring-boot-jarmode-tools",
|
||||
|
||||
@@ -90,6 +90,7 @@ dependencies {
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-hateoas", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-hazelcast", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-http", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-http-codec", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-integration", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-jackson", configuration: "autoConfigurationMetadata"))
|
||||
autoConfiguration(project(path: ":spring-boot-project:spring-boot-jdbc", configuration: "autoConfigurationMetadata"))
|
||||
@@ -159,6 +160,7 @@ dependencies {
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-hateoas", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-hazelcast", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-http", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-http-codec", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-integration", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-jackson", configuration: "configurationPropertiesMetadata"))
|
||||
configurationProperties(project(path: ":spring-boot-project:spring-boot-jdbc", configuration: "configurationPropertiesMetadata"))
|
||||
@@ -208,6 +210,7 @@ dependencies {
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-devtools"))
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-docker-compose"))
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-http"))
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-http-codec"))
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-integration"))
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-jackson"))
|
||||
implementation(project(path: ":spring-boot-project:spring-boot-jdbc"))
|
||||
|
||||
24
spring-boot-project/spring-boot-http-codec/build.gradle
Normal file
24
spring-boot-project/spring-boot-http-codec/build.gradle
Normal file
@@ -0,0 +1,24 @@
|
||||
plugins {
|
||||
id "java-library"
|
||||
id "org.springframework.boot.auto-configuration"
|
||||
id "org.springframework.boot.configuration-properties"
|
||||
id "org.springframework.boot.deployed"
|
||||
id "org.springframework.boot.optional-dependencies"
|
||||
}
|
||||
|
||||
description = "Spring Boot HTTP Codec"
|
||||
|
||||
dependencies {
|
||||
api(project(":spring-boot-project:spring-boot"))
|
||||
api("org.springframework:spring-web")
|
||||
|
||||
implementation("org.springframework:spring-webflux")
|
||||
|
||||
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
|
||||
optional(project(":spring-boot-project:spring-boot-jackson"))
|
||||
|
||||
testImplementation(project(":spring-boot-project:spring-boot-test"))
|
||||
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
|
||||
testRuntimeOnly("ch.qos.logback:logback-classic")
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.http.codec;
|
||||
package org.springframework.boot.http.codec.autoconfigure;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
@@ -69,19 +69,15 @@ public class CodecsAutoConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties({ org.springframework.boot.autoconfigure.codec.CodecProperties.class,
|
||||
HttpCodecsProperties.class })
|
||||
@EnableConfigurationProperties(HttpCodecsProperties.class)
|
||||
static class DefaultCodecsConfiguration {
|
||||
|
||||
@Bean
|
||||
DefaultCodecCustomizer defaultCodecCustomizer(
|
||||
org.springframework.boot.autoconfigure.codec.CodecProperties codecProperties,
|
||||
HttpCodecsProperties httpCodecProperties, Environment environment) {
|
||||
return new DefaultCodecCustomizer(
|
||||
httpCodecProperties.isLogRequestDetails(codecProperties::isLogRequestDetails),
|
||||
httpCodecProperties.getMaxInMemorySize(codecProperties::getMaxInMemorySize));
|
||||
DefaultCodecCustomizer defaultCodecCustomizer(HttpCodecsProperties httpCodecProperties,
|
||||
Environment environment) {
|
||||
return new DefaultCodecCustomizer(httpCodecProperties.isLogRequestDetails(),
|
||||
httpCodecProperties.getMaxInMemorySize());
|
||||
}
|
||||
|
||||
static final class DefaultCodecCustomizer implements CodecCustomizer, Ordered {
|
||||
@@ -14,9 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.http.codec;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
package org.springframework.boot.http.codec.autoconfigure;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.util.unit.DataSize;
|
||||
@@ -36,9 +34,6 @@ public class HttpCodecsProperties {
|
||||
*/
|
||||
private boolean logRequestDetails;
|
||||
|
||||
@Deprecated(since = "3.5.0", forRemoval = true)
|
||||
private boolean logRequestDetailsBound = false;
|
||||
|
||||
/**
|
||||
* Limit on the number of bytes that can be buffered whenever the input stream needs
|
||||
* to be aggregated. This applies only to the auto-configured WebFlux server and
|
||||
@@ -47,33 +42,20 @@ public class HttpCodecsProperties {
|
||||
*/
|
||||
private DataSize maxInMemorySize;
|
||||
|
||||
@Deprecated(since = "3.5.0", forRemoval = true)
|
||||
private boolean maxInMemorySizeBound = false;
|
||||
|
||||
public boolean isLogRequestDetails() {
|
||||
return this.logRequestDetails;
|
||||
}
|
||||
|
||||
boolean isLogRequestDetails(Supplier<Boolean> fallback) {
|
||||
return this.logRequestDetailsBound ? this.logRequestDetails : fallback.get();
|
||||
}
|
||||
|
||||
public void setLogRequestDetails(boolean logRequestDetails) {
|
||||
this.logRequestDetails = logRequestDetails;
|
||||
this.logRequestDetailsBound = true;
|
||||
}
|
||||
|
||||
public DataSize getMaxInMemorySize() {
|
||||
return this.maxInMemorySize;
|
||||
}
|
||||
|
||||
DataSize getMaxInMemorySize(Supplier<DataSize> fallback) {
|
||||
return this.maxInMemorySizeBound ? this.maxInMemorySize : fallback.get();
|
||||
}
|
||||
|
||||
public void setMaxInMemorySize(DataSize maxInMemorySize) {
|
||||
this.maxInMemorySize = maxInMemorySize;
|
||||
this.maxInMemorySizeBound = true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.
|
||||
@@ -17,4 +17,4 @@
|
||||
/**
|
||||
* Auto-configuration for HTTP codecs.
|
||||
*/
|
||||
package org.springframework.boot.autoconfigure.http.codec;
|
||||
package org.springframework.boot.http.codec.autoconfigure;
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"groups": [],
|
||||
"properties": []
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.autoconfigure.http.codec;
|
||||
package org.springframework.boot.http.codec.autoconfigure;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -22,8 +22,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext;
|
||||
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.boot.web.codec.CodecCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -42,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
class CodecsAutoConfigurationTests {
|
||||
|
||||
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(CodecsAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
@@ -51,13 +51,6 @@ class CodecsAutoConfigurationTests {
|
||||
.hasFieldOrPropertyWithValue("enableLoggingRequestDetails", false));
|
||||
}
|
||||
|
||||
@Test
|
||||
void loggingRequestDetailsCustomizerShouldUseCodecProperties() {
|
||||
this.contextRunner.withPropertyValues("spring.codec.log-request-details=true")
|
||||
.run((context) -> assertThat(defaultCodecs(context))
|
||||
.hasFieldOrPropertyWithValue("enableLoggingRequestDetails", true));
|
||||
}
|
||||
|
||||
@Test
|
||||
void loggingRequestDetailsCustomizerShouldUseHttpCodecsProperties() {
|
||||
this.contextRunner.withPropertyValues("spring.http.codecs.log-request-details=true")
|
||||
@@ -65,21 +58,6 @@ class CodecsAutoConfigurationTests {
|
||||
.hasFieldOrPropertyWithValue("enableLoggingRequestDetails", true));
|
||||
}
|
||||
|
||||
@Test
|
||||
void logRequestDetailsShouldGivePriorityToHttpCodecProperty() {
|
||||
this.contextRunner
|
||||
.withPropertyValues("spring.http.codecs.log-request-details=true", "spring.codec.log-request-details=false")
|
||||
.run((context) -> assertThat(defaultCodecs(context))
|
||||
.hasFieldOrPropertyWithValue("enableLoggingRequestDetails", true));
|
||||
}
|
||||
|
||||
@Test
|
||||
void maxInMemorySizeShouldUseCodecProperties() {
|
||||
this.contextRunner.withPropertyValues("spring.codec.max-in-memory-size=64KB")
|
||||
.run((context) -> assertThat(defaultCodecs(context)).hasFieldOrPropertyWithValue("maxInMemorySize",
|
||||
64 * 1024));
|
||||
}
|
||||
|
||||
@Test
|
||||
void maxInMemorySizeShouldUseHttpCodecProperties() {
|
||||
this.contextRunner.withPropertyValues("spring.http.codecs.max-in-memory-size=64KB")
|
||||
@@ -87,14 +65,6 @@ class CodecsAutoConfigurationTests {
|
||||
64 * 1024));
|
||||
}
|
||||
|
||||
@Test
|
||||
void maxInMemorySizeShouldGivePriorityToHttpCodecProperty() {
|
||||
this.contextRunner
|
||||
.withPropertyValues("spring.http.codecs.max-in-memory-size=64KB", "spring.codec.max-in-memory-size=32KB")
|
||||
.run((context) -> assertThat(defaultCodecs(context)).hasFieldOrPropertyWithValue("maxInMemorySize",
|
||||
64 * 1024));
|
||||
}
|
||||
|
||||
@Test
|
||||
void defaultCodecCustomizerBeanShouldHaveOrderZero() {
|
||||
this.contextRunner
|
||||
@@ -124,12 +94,12 @@ class CodecsAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
void maxInMemorySizeEnforcedInDefaultCodecs() {
|
||||
this.contextRunner.withPropertyValues("spring.codec.max-in-memory-size=1MB")
|
||||
this.contextRunner.withPropertyValues("spring.http.codecs.max-in-memory-size=1MB")
|
||||
.run((context) -> assertThat(defaultCodecs(context)).hasFieldOrPropertyWithValue("maxInMemorySize",
|
||||
1048576));
|
||||
}
|
||||
|
||||
private DefaultCodecs defaultCodecs(AssertableWebApplicationContext context) {
|
||||
private DefaultCodecs defaultCodecs(AssertableApplicationContext context) {
|
||||
CodecCustomizer customizer = context.getBean(CodecCustomizer.class);
|
||||
CodecConfigurer configurer = new DefaultClientCodecConfigurer();
|
||||
customizer.customize(configurer);
|
||||
@@ -5,6 +5,7 @@ plugins {
|
||||
description = "Starter for building WebFlux applications using Spring Framework's Reactive Web support"
|
||||
|
||||
dependencies {
|
||||
api(project(":spring-boot-project:spring-boot-http-codec"))
|
||||
api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter"))
|
||||
api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-json"))
|
||||
api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-reactor-netty"))
|
||||
|
||||
@@ -60,6 +60,7 @@ dependencies {
|
||||
optional(project(":spring-boot-project:spring-boot-groovy-templates"))
|
||||
optional(project(":spring-boot-project:spring-boot-hateoas"))
|
||||
optional(project(":spring-boot-project:spring-boot-http"))
|
||||
optional(project(":spring-boot-project:spring-boot-http-codec"))
|
||||
optional(project(":spring-boot-project:spring-boot-jackson"))
|
||||
optional(project(":spring-boot-project:spring-boot-jdbc"))
|
||||
optional(project(":spring-boot-project:spring-boot-jooq"))
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
* @author Brian Clozel
|
||||
* @since 2.7.0
|
||||
* @see GraphQlTest
|
||||
* @see org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration
|
||||
* @see org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration
|
||||
* @see org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration
|
||||
* @see org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
@@ -44,7 +43,8 @@ import org.springframework.web.server.WebHandler;
|
||||
* @author Andy Wilkinson
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@AutoConfiguration(after = { CodecsAutoConfiguration.class, WebFluxAutoConfiguration.class })
|
||||
@AutoConfiguration(after = WebFluxAutoConfiguration.class,
|
||||
afterName = "org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration")
|
||||
@ConditionalOnClass({ WebClient.class, WebTestClient.class })
|
||||
@Import(WebTestClientSecurityConfiguration.class)
|
||||
@EnableConfigurationProperties
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# AutoConfigureGraphQl auto-configuration imports
|
||||
org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration
|
||||
optional:org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration
|
||||
optional:org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# AutoConfigureWebClient auto-configuration imports
|
||||
optional:org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration
|
||||
optional:org.springframework.boot.http.autoconfigure.HttpMessageConvertersAutoConfiguration
|
||||
org.springframework.boot.test.autoconfigure.web.client.WebClientRestTemplateAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration
|
||||
@@ -1,7 +1,7 @@
|
||||
# AutoConfigureWebFlux auto-configuration imports
|
||||
org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration
|
||||
optional:org.springframework.boot.freemarker.autoconfigure.FreeMarkerAutoConfiguration
|
||||
org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration
|
||||
optional:org.springframework.boot.http.codec.autoconfigure.CodecsAutoConfiguration
|
||||
optional:org.springframework.boot.mustache.autoconfigure.MustacheAutoConfiguration
|
||||
optional:org.springframework.boot.thymeleaf.autoconfigure.ThymeleafAutoConfiguration
|
||||
optional:org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration
|
||||
|
||||
Reference in New Issue
Block a user