Skip to content

Commit 0e44f1d

Browse files
committed
Merge branch '3.5.x'
2 parents 62177a1 + 5b960b2 commit 0e44f1d

File tree

11 files changed

+26
-56
lines changed

11 files changed

+26
-56
lines changed

build-plugin/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
import org.springframework.util.Assert;
6565
import org.springframework.util.StreamUtils;
6666
import org.springframework.util.StringUtils;
67+
import org.springframework.util.function.ThrowingSupplier;
6768

6869
/**
6970
* A {@link CopyAction} for creating a Spring Boot zip archive (typically a jar or war).
@@ -325,7 +326,7 @@ private void writeJarToolsIfNecessary() throws IOException {
325326
private void writeJarModeLibrary(String location, JarModeLibrary library) throws IOException {
326327
String name = location + library.getName();
327328
writeEntry(name, ZipEntryContentWriter.fromInputStream(library.openStream()), false,
328-
(entry) -> prepareStoredEntry(library.openStream(), false, entry));
329+
(entry) -> prepareStoredEntry(library::openStream, false, entry));
329330
if (BootZipCopyAction.this.layerResolver != null) {
330331
Layer layer = BootZipCopyAction.this.layerResolver.getLayer(library);
331332
Assert.state(this.layerIndex != null, "'layerIndex' must not be null");
@@ -429,12 +430,12 @@ private void prepareEntry(ZipArchiveEntry entry, String name, @Nullable Long tim
429430
}
430431

431432
private void prepareStoredEntry(FileCopyDetails details, ZipArchiveEntry archiveEntry) throws IOException {
432-
prepareStoredEntry(details.open(), BootZipCopyAction.this.requiresUnpack.isSatisfiedBy(details),
433+
prepareStoredEntry(details::open, BootZipCopyAction.this.requiresUnpack.isSatisfiedBy(details),
433434
archiveEntry);
434435
}
435436

436-
private void prepareStoredEntry(InputStream input, boolean unpack, ZipArchiveEntry archiveEntry)
437-
throws IOException {
437+
private void prepareStoredEntry(ThrowingSupplier<InputStream> input, boolean unpack,
438+
ZipArchiveEntry archiveEntry) throws IOException {
438439
new StoredEntryPreparator(input, unpack).prepareStoredEntry(archiveEntry);
439440
}
440441

@@ -564,10 +565,10 @@ private static class StoredEntryPreparator {
564565

565566
private long size;
566567

567-
StoredEntryPreparator(InputStream inputStream, boolean unpack) throws IOException {
568+
StoredEntryPreparator(ThrowingSupplier<InputStream> input, boolean unpack) throws IOException {
568569
this.unpack = unpack;
569-
try (inputStream) {
570-
load(inputStream);
570+
try (InputStream stream = input.get()) {
571+
load(stream);
571572
}
572573
}
573574

buildpack/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/configuration/DockerRegistryConfigAuthenticationTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void cleanup() {
7676
}
7777
""")
7878
@Test
79-
void getAuthHeaderWhenAuthForDockerDomain(@ResourcesRoot Path directory) throws Exception {
79+
void getAuthHeaderWhenAuthForDockerDomain(@ResourcesRoot Path directory) {
8080
this.environment.put("DOCKER_CONFIG", directory.toString());
8181
ImageReference imageReference = ImageReference.of("docker.io/ubuntu:latest");
8282
String authHeader = getAuthHeader(imageReference);
@@ -99,7 +99,7 @@ void getAuthHeaderWhenAuthForDockerDomain(@ResourcesRoot Path directory) throws
9999
}
100100
""")
101101
@Test
102-
void getAuthHeaderWhenAuthForLegacyDockerDomain(@ResourcesRoot Path directory) throws Exception {
102+
void getAuthHeaderWhenAuthForLegacyDockerDomain(@ResourcesRoot Path directory) {
103103
this.environment.put("DOCKER_CONFIG", directory.toString());
104104
ImageReference imageReference = ImageReference.of("index.docker.io/ubuntu:latest");
105105
String authHeader = getAuthHeader(imageReference);
@@ -121,7 +121,7 @@ void getAuthHeaderWhenAuthForLegacyDockerDomain(@ResourcesRoot Path directory) t
121121
}
122122
""")
123123
@Test
124-
void getAuthHeaderWhenAuthForCustomDomain(@ResourcesRoot Path directory) throws Exception {
124+
void getAuthHeaderWhenAuthForCustomDomain(@ResourcesRoot Path directory) {
125125
this.environment.put("DOCKER_CONFIG", directory.toString());
126126
ImageReference imageReference = ImageReference.of("my-registry.example.com/ubuntu:latest");
127127
String authHeader = getAuthHeader(imageReference);
@@ -143,7 +143,7 @@ void getAuthHeaderWhenAuthForCustomDomain(@ResourcesRoot Path directory) throws
143143
}
144144
""")
145145
@Test
146-
void getAuthHeaderWhenAuthForCustomDomainWithLegacyFormat(@ResourcesRoot Path directory) throws Exception {
146+
void getAuthHeaderWhenAuthForCustomDomainWithLegacyFormat(@ResourcesRoot Path directory) {
147147
this.environment.put("DOCKER_CONFIG", directory.toString());
148148
ImageReference imageReference = ImageReference.of("my-registry.example.com/ubuntu:latest");
149149
String authHeader = getAuthHeader(imageReference);
@@ -160,7 +160,7 @@ void getAuthHeaderWhenAuthForCustomDomainWithLegacyFormat(@ResourcesRoot Path di
160160
}
161161
""")
162162
@Test
163-
void getAuthHeaderWhenEmptyConfigDirectoryReturnsFallback(@ResourcesRoot Path directory) throws Exception {
163+
void getAuthHeaderWhenEmptyConfigDirectoryReturnsFallback(@ResourcesRoot Path directory) {
164164
this.environment.put("DOCKER_CONFIG", directory.toString());
165165
ImageReference imageReference = ImageReference.of("docker.io/ubuntu:latest");
166166
String authHeader = getAuthHeader(imageReference, DockerRegistryAuthentication.EMPTY_USER);

module/spring-boot-graphql/src/test/java/org/springframework/boot/graphql/autoconfigure/security/GraphQlWebMvcSecurityAutoConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static class BookService {
173173
static class SecurityConfig {
174174

175175
@Bean
176-
DefaultSecurityFilterChain springWebFilterChain(HttpSecurity http) throws Exception {
176+
DefaultSecurityFilterChain springWebFilterChain(HttpSecurity http) {
177177
return http.csrf(CsrfConfigurer::disable)
178178
// Demonstrate that method security works
179179
// Best practice to use both for defense in depth

module/spring-boot-jersey/src/main/java/org/springframework/boot/jersey/autoconfigure/actuate/web/JerseyWebEndpointManagementContextConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import org.springframework.boot.actuate.endpoint.ExposableEndpoint;
4242
import org.springframework.boot.actuate.endpoint.OperationResponseBody;
4343
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
44-
import org.springframework.boot.actuate.endpoint.jackson.EndpointJackson2ObjectMapper;
4544
import org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver;
4645
import org.springframework.boot.actuate.endpoint.web.EndpointMapping;
4746
import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
@@ -109,7 +108,7 @@ JerseyAdditionalHealthEndpointPathsManagementResourcesRegistrar jerseyDifferentP
109108
}
110109

111110
@Bean
112-
@ConditionalOnBean(EndpointJackson2ObjectMapper.class)
111+
@ConditionalOnBean(org.springframework.boot.actuate.endpoint.jackson.EndpointJackson2ObjectMapper.class)
113112
@SuppressWarnings("removal")
114113
ResourceConfigCustomizer endpointJackson2ObjectMapperResourceConfigCustomizer(
115114
org.springframework.boot.actuate.endpoint.jackson.EndpointJackson2ObjectMapper endpointJackson2ObjectMapper) {

module/spring-boot-jetty/src/main/java/org/springframework/boot/jetty/autoconfigure/JettyVirtualThreadsWebServerFactoryCustomizer.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,9 @@
1919
import org.eclipse.jetty.util.VirtualThreads;
2020
import org.eclipse.jetty.util.thread.VirtualThreadPool;
2121

22-
import org.springframework.boot.context.properties.bind.Bindable;
23-
import org.springframework.boot.context.properties.bind.Binder;
2422
import org.springframework.boot.jetty.ConfigurableJettyWebServerFactory;
2523
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
26-
import org.springframework.context.EnvironmentAware;
2724
import org.springframework.core.Ordered;
28-
import org.springframework.core.env.Environment;
2925
import org.springframework.util.Assert;
3026

3127
/**
@@ -36,16 +32,7 @@
3632
* @since 4.0.0
3733
*/
3834
public class JettyVirtualThreadsWebServerFactoryCustomizer
39-
implements WebServerFactoryCustomizer<ConfigurableJettyWebServerFactory>, Ordered, EnvironmentAware {
40-
41-
private final JettyServerProperties jettyProperties;
42-
43-
private final boolean bind;
44-
45-
public JettyVirtualThreadsWebServerFactoryCustomizer(JettyServerProperties jettyProperties) {
46-
this.jettyProperties = jettyProperties;
47-
this.bind = false;
48-
}
35+
implements WebServerFactoryCustomizer<ConfigurableJettyWebServerFactory>, Ordered {
4936

5037
@Override
5138
public void customize(ConfigurableJettyWebServerFactory factory) {
@@ -60,11 +47,4 @@ public int getOrder() {
6047
return JettyWebServerFactoryCustomizer.ORDER + 1;
6148
}
6249

63-
@Override
64-
public void setEnvironment(Environment environment) {
65-
if (this.bind) {
66-
Binder.get(environment).bind("server.jetty", Bindable.ofInstance(this.jettyProperties));
67-
}
68-
}
69-
7050
}

module/spring-boot-jetty/src/main/java/org/springframework/boot/jetty/autoconfigure/JettyWebServerConfiguration.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,16 @@
3838
@Configuration(proxyBeanMethods = false)
3939
public class JettyWebServerConfiguration {
4040

41-
private final JettyServerProperties jettyProperties;
42-
43-
JettyWebServerConfiguration(JettyServerProperties jettyProperties) {
44-
this.jettyProperties = jettyProperties;
45-
}
46-
4741
@Bean
4842
JettyWebServerFactoryCustomizer jettyWebServerFactoryCustomizer(Environment environment,
49-
ServerProperties serverProperties) {
50-
return new JettyWebServerFactoryCustomizer(environment, serverProperties, this.jettyProperties);
43+
ServerProperties serverProperties, JettyServerProperties jettyProperties) {
44+
return new JettyWebServerFactoryCustomizer(environment, serverProperties, jettyProperties);
5145
}
5246

5347
@Bean
5448
@ConditionalOnThreading(Threading.VIRTUAL)
5549
JettyVirtualThreadsWebServerFactoryCustomizer jettyVirtualThreadsWebServerFactoryCustomizer() {
56-
return new JettyVirtualThreadsWebServerFactoryCustomizer(this.jettyProperties);
50+
return new JettyVirtualThreadsWebServerFactoryCustomizer();
5751
}
5852

5953
}

module/spring-boot-jetty/src/test/java/org/springframework/boot/jetty/autoconfigure/JettyVirtualThreadsWebServerFactoryCustomizerTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ class JettyVirtualThreadsWebServerFactoryCustomizerTests {
3838
@Test
3939
@EnabledForJreRange(min = JRE.JAVA_21)
4040
void shouldConfigureVirtualThreads() {
41-
JettyServerProperties properties = new JettyServerProperties();
42-
JettyVirtualThreadsWebServerFactoryCustomizer customizer = new JettyVirtualThreadsWebServerFactoryCustomizer(
43-
properties);
41+
JettyVirtualThreadsWebServerFactoryCustomizer customizer = new JettyVirtualThreadsWebServerFactoryCustomizer();
4442
ConfigurableJettyWebServerFactory factory = mock(ConfigurableJettyWebServerFactory.class);
4543
customizer.customize(factory);
4644
then(factory).should().setThreadPool(assertArg((threadPool) -> {

module/spring-boot-webflux-test/src/test/java/org/springframework/boot/webflux/test/autoconfigure/WebFluxTestJsonComponentIntegrationTests.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import org.junit.jupiter.api.Test;
2020

2121
import org.springframework.beans.factory.annotation.Autowired;
22-
import org.springframework.context.ConfigurableApplicationContext;
2322
import org.springframework.test.json.JsonCompareMode;
2423
import org.springframework.test.web.reactive.server.WebTestClient;
2524

@@ -35,9 +34,6 @@ class WebFluxTestJsonComponentIntegrationTests {
3534
@Autowired
3635
private WebTestClient webClient;
3736

38-
@Autowired
39-
private ConfigurableApplicationContext context;
40-
4137
@Test
4238
void shouldFindJsonComponent() {
4339
this.webClient.post()

module/spring-boot-webflux-test/src/test/java/org/springframework/boot/webflux/test/autoconfigure/WebFluxTypeExcludeFilterTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import tools.jackson.databind.module.SimpleModule;
2424

2525
import org.springframework.boot.jackson.JacksonComponent;
26-
import org.springframework.boot.jackson2.JsonComponent;
2726
import org.springframework.context.annotation.ComponentScan.Filter;
2827
import org.springframework.context.annotation.FilterType;
2928
import org.springframework.core.type.classreading.MetadataReader;
@@ -209,7 +208,7 @@ static class ExampleModule2 extends com.fasterxml.jackson.databind.module.Simple
209208

210209
}
211210

212-
@JsonComponent
211+
@org.springframework.boot.jackson2.JsonComponent
213212
@SuppressWarnings("removal")
214213
static class ExampleJsonComponent {
215214

module/spring-boot-webmvc-test/src/test/java/org/springframework/boot/webmvc/test/autoconfigure/WebMvcTypeExcludeFilterTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import tools.jackson.databind.module.SimpleModule;
2323

2424
import org.springframework.boot.jackson.JacksonComponent;
25-
import org.springframework.boot.jackson2.JsonComponent;
2625
import org.springframework.boot.webmvc.autoconfigure.WebMvcRegistrations;
2726
import org.springframework.context.annotation.ComponentScan.Filter;
2827
import org.springframework.context.annotation.FilterType;
@@ -224,7 +223,7 @@ static class ExampleModule2 extends com.fasterxml.jackson.databind.module.Simple
224223

225224
}
226225

227-
@JsonComponent
226+
@org.springframework.boot.jackson2.JsonComponent
228227
@SuppressWarnings("removal")
229228
static class ExampleJsonComponent {
230229

0 commit comments

Comments
 (0)