Merge branch '3.5.x'

This commit is contained in:
Andy Wilkinson
2025-11-10 10:39:32 +00:00
11 changed files with 26 additions and 56 deletions
@@ -173,7 +173,7 @@ class GraphQlWebMvcSecurityAutoConfigurationTests {
static class SecurityConfig {
@Bean
DefaultSecurityFilterChain springWebFilterChain(HttpSecurity http) throws Exception {
DefaultSecurityFilterChain springWebFilterChain(HttpSecurity http) {
return http.csrf(CsrfConfigurer::disable)
// Demonstrate that method security works
// Best practice to use both for defense in depth
@@ -41,7 +41,6 @@ import org.springframework.boot.actuate.endpoint.EndpointId;
import org.springframework.boot.actuate.endpoint.ExposableEndpoint;
import org.springframework.boot.actuate.endpoint.OperationResponseBody;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.jackson.EndpointJackson2ObjectMapper;
import org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver;
import org.springframework.boot.actuate.endpoint.web.EndpointMapping;
import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
@@ -109,7 +108,7 @@ class JerseyWebEndpointManagementContextConfiguration {
}
@Bean
@ConditionalOnBean(EndpointJackson2ObjectMapper.class)
@ConditionalOnBean(org.springframework.boot.actuate.endpoint.jackson.EndpointJackson2ObjectMapper.class)
@SuppressWarnings("removal")
ResourceConfigCustomizer endpointJackson2ObjectMapperResourceConfigCustomizer(
org.springframework.boot.actuate.endpoint.jackson.EndpointJackson2ObjectMapper endpointJackson2ObjectMapper) {
@@ -19,13 +19,9 @@ package org.springframework.boot.jetty.autoconfigure;
import org.eclipse.jetty.util.VirtualThreads;
import org.eclipse.jetty.util.thread.VirtualThreadPool;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.boot.jetty.ConfigurableJettyWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.Ordered;
import org.springframework.core.env.Environment;
import org.springframework.util.Assert;
/**
@@ -36,16 +32,7 @@ import org.springframework.util.Assert;
* @since 4.0.0
*/
public class JettyVirtualThreadsWebServerFactoryCustomizer
implements WebServerFactoryCustomizer<ConfigurableJettyWebServerFactory>, Ordered, EnvironmentAware {
private final JettyServerProperties jettyProperties;
private final boolean bind;
public JettyVirtualThreadsWebServerFactoryCustomizer(JettyServerProperties jettyProperties) {
this.jettyProperties = jettyProperties;
this.bind = false;
}
implements WebServerFactoryCustomizer<ConfigurableJettyWebServerFactory>, Ordered {
@Override
public void customize(ConfigurableJettyWebServerFactory factory) {
@@ -60,11 +47,4 @@ public class JettyVirtualThreadsWebServerFactoryCustomizer
return JettyWebServerFactoryCustomizer.ORDER + 1;
}
@Override
public void setEnvironment(Environment environment) {
if (this.bind) {
Binder.get(environment).bind("server.jetty", Bindable.ofInstance(this.jettyProperties));
}
}
}
@@ -38,22 +38,16 @@ import org.springframework.core.env.Environment;
@Configuration(proxyBeanMethods = false)
public class JettyWebServerConfiguration {
private final JettyServerProperties jettyProperties;
JettyWebServerConfiguration(JettyServerProperties jettyProperties) {
this.jettyProperties = jettyProperties;
}
@Bean
JettyWebServerFactoryCustomizer jettyWebServerFactoryCustomizer(Environment environment,
ServerProperties serverProperties) {
return new JettyWebServerFactoryCustomizer(environment, serverProperties, this.jettyProperties);
ServerProperties serverProperties, JettyServerProperties jettyProperties) {
return new JettyWebServerFactoryCustomizer(environment, serverProperties, jettyProperties);
}
@Bean
@ConditionalOnThreading(Threading.VIRTUAL)
JettyVirtualThreadsWebServerFactoryCustomizer jettyVirtualThreadsWebServerFactoryCustomizer() {
return new JettyVirtualThreadsWebServerFactoryCustomizer(this.jettyProperties);
return new JettyVirtualThreadsWebServerFactoryCustomizer();
}
}
@@ -38,9 +38,7 @@ class JettyVirtualThreadsWebServerFactoryCustomizerTests {
@Test
@EnabledForJreRange(min = JRE.JAVA_21)
void shouldConfigureVirtualThreads() {
JettyServerProperties properties = new JettyServerProperties();
JettyVirtualThreadsWebServerFactoryCustomizer customizer = new JettyVirtualThreadsWebServerFactoryCustomizer(
properties);
JettyVirtualThreadsWebServerFactoryCustomizer customizer = new JettyVirtualThreadsWebServerFactoryCustomizer();
ConfigurableJettyWebServerFactory factory = mock(ConfigurableJettyWebServerFactory.class);
customizer.customize(factory);
then(factory).should().setThreadPool(assertArg((threadPool) -> {
@@ -19,7 +19,6 @@ package org.springframework.boot.webflux.test.autoconfigure;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.test.json.JsonCompareMode;
import org.springframework.test.web.reactive.server.WebTestClient;
@@ -35,9 +34,6 @@ class WebFluxTestJsonComponentIntegrationTests {
@Autowired
private WebTestClient webClient;
@Autowired
private ConfigurableApplicationContext context;
@Test
void shouldFindJsonComponent() {
this.webClient.post()
@@ -23,7 +23,6 @@ import reactor.core.publisher.Mono;
import tools.jackson.databind.module.SimpleModule;
import org.springframework.boot.jackson.JacksonComponent;
import org.springframework.boot.jackson2.JsonComponent;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.FilterType;
import org.springframework.core.type.classreading.MetadataReader;
@@ -209,7 +208,7 @@ class WebFluxTypeExcludeFilterTests {
}
@JsonComponent
@org.springframework.boot.jackson2.JsonComponent
@SuppressWarnings("removal")
static class ExampleJsonComponent {
@@ -22,7 +22,6 @@ import org.junit.jupiter.api.Test;
import tools.jackson.databind.module.SimpleModule;
import org.springframework.boot.jackson.JacksonComponent;
import org.springframework.boot.jackson2.JsonComponent;
import org.springframework.boot.webmvc.autoconfigure.WebMvcRegistrations;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.FilterType;
@@ -224,7 +223,7 @@ class WebMvcTypeExcludeFilterTests {
}
@JsonComponent
@org.springframework.boot.jackson2.JsonComponent
@SuppressWarnings("removal")
static class ExampleJsonComponent {