Skip to content

Commit fe371ab

Browse files
committed
Start building against Spring Framework 7.0.0-M9 snapshots
See gh-47008
1 parent 62649ae commit fe371ab

File tree

8 files changed

+37
-19
lines changed

8 files changed

+37
-19
lines changed

buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/github/StandardGitHub.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.fasterxml.jackson.databind.ObjectMapper;
2323

2424
import org.springframework.http.MediaType;
25-
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
2625
import org.springframework.web.client.RestTemplate;
2726
import org.springframework.web.util.DefaultUriBuilderFactory;
2827
import org.springframework.web.util.UriTemplateHandler;
@@ -60,9 +59,10 @@ public GitHubRepository getRepository(String organization, String name) {
6059
return new StandardGitHubRepository(restTemplate);
6160
}
6261

63-
@SuppressWarnings("removal")
62+
@SuppressWarnings({ "deprecation", "removal" })
6463
private RestTemplate createRestTemplate() {
65-
return new RestTemplate(Collections.singletonList(new MappingJackson2HttpMessageConverter(new ObjectMapper())));
64+
return new RestTemplate(Collections.singletonList(
65+
new org.springframework.http.converter.json.MappingJackson2HttpMessageConverter(new ObjectMapper())));
6666
}
6767

6868
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mavenVersion=3.9.10
1919
mockitoVersion=5.19.0
2020
nativeBuildToolsVersion=0.11.0
2121
snakeYamlVersion=2.4
22-
springFrameworkVersion=7.0.0-M8
22+
springFrameworkVersion=7.0.0-SNAPSHOT
2323
springFramework60xVersion=6.0.23
2424
tomcatVersion=11.0.10
2525
nullabilityPluginVersion=0.0.4

module/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/HttpStatusHandlerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ void respondsOk() throws Exception {
6868

6969
@Test
7070
void respondsWithStatus() throws Exception {
71-
HttpStatusHandler handler = new HttpStatusHandler(HttpStatus.I_AM_A_TEAPOT);
71+
HttpStatusHandler handler = new HttpStatusHandler(HttpStatus.EXPECTATION_FAILED);
7272
handler.handle(this.request, this.response);
73-
assertThat(this.servletResponse.getStatus()).isEqualTo(418);
73+
assertThat(this.servletResponse.getStatus()).isEqualTo(417);
7474
}
7575

7676
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void customizersAreCalled() {
8282
ServerHttpRequest request = MockServerHttpRequest.get("").build();
8383
ServerHttpResponse response = new MockServerHttpResponse();
8484
httpHandler.handle(request, response).block();
85-
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.I_AM_A_TEAPOT);
85+
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.EXPECTATION_FAILED);
8686
});
8787
}
8888

@@ -131,7 +131,7 @@ static class WebHttpHandlerBuilderCustomizers {
131131
WebHttpHandlerBuilderCustomizer customizerDecorator() {
132132
return (webHttpHandlerBuilder) -> webHttpHandlerBuilder
133133
.httpHandlerDecorator(((httpHandler) -> (request, response) -> {
134-
response.setStatusCode(HttpStatus.I_AM_A_TEAPOT);
134+
response.setStatusCode(HttpStatus.EXPECTATION_FAILED);
135135
return response.setComplete();
136136
}));
137137
}

module/spring-boot-webflux/src/test/java/org/springframework/boot/webflux/error/DefaultErrorAttributesTests.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ void annotatedResponseStatusCode() {
9898
MockServerHttpRequest request = MockServerHttpRequest.get("/test").build();
9999
Map<String, Object> attributes = this.errorAttributes.getErrorAttributes(buildServerRequest(request, error),
100100
ErrorAttributeOptions.defaults());
101-
assertThat(attributes).containsEntry("error", HttpStatus.I_AM_A_TEAPOT.getReasonPhrase());
101+
assertThat(attributes).containsEntry("error", HttpStatus.EXPECTATION_FAILED.getReasonPhrase());
102102
assertThat(attributes).doesNotContainKey("message");
103-
assertThat(attributes).containsEntry("status", HttpStatus.I_AM_A_TEAPOT.value());
103+
assertThat(attributes).containsEntry("status", HttpStatus.EXPECTATION_FAILED.value());
104104
}
105105

106106
@Test
@@ -109,9 +109,9 @@ void annotatedResponseStatusCodeWithExceptionMessage() {
109109
MockServerHttpRequest request = MockServerHttpRequest.get("/test").build();
110110
Map<String, Object> attributes = this.errorAttributes.getErrorAttributes(buildServerRequest(request, error),
111111
ErrorAttributeOptions.of(Include.MESSAGE, Include.STATUS, Include.ERROR));
112-
assertThat(attributes).containsEntry("error", HttpStatus.I_AM_A_TEAPOT.getReasonPhrase());
112+
assertThat(attributes).containsEntry("error", HttpStatus.EXPECTATION_FAILED.getReasonPhrase());
113113
assertThat(attributes).containsEntry("message", "Test Message");
114-
assertThat(attributes).containsEntry("status", HttpStatus.I_AM_A_TEAPOT.value());
114+
assertThat(attributes).containsEntry("status", HttpStatus.EXPECTATION_FAILED.value());
115115
}
116116

117117
@Test
@@ -120,8 +120,8 @@ void annotatedResponseStatusCodeWithCustomReasonPhrase() {
120120
MockServerHttpRequest request = MockServerHttpRequest.get("/test").build();
121121
Map<String, Object> attributes = this.errorAttributes.getErrorAttributes(buildServerRequest(request, error),
122122
ErrorAttributeOptions.of(Include.MESSAGE, Include.STATUS, Include.ERROR));
123-
assertThat(attributes).containsEntry("error", HttpStatus.I_AM_A_TEAPOT.getReasonPhrase());
124-
assertThat(attributes).containsEntry("status", HttpStatus.I_AM_A_TEAPOT.value());
123+
assertThat(attributes).containsEntry("error", HttpStatus.EXPECTATION_FAILED.getReasonPhrase());
124+
assertThat(attributes).containsEntry("status", HttpStatus.EXPECTATION_FAILED.value());
125125
assertThat(attributes).containsEntry("message", "Nope!");
126126
}
127127

@@ -385,7 +385,7 @@ int method(String firstParam) {
385385
return 42;
386386
}
387387

388-
@ResponseStatus(HttpStatus.I_AM_A_TEAPOT)
388+
@ResponseStatus(HttpStatus.EXPECTATION_FAILED)
389389
static class CustomException extends RuntimeException {
390390

391391
CustomException() {
@@ -397,7 +397,7 @@ static class CustomException extends RuntimeException {
397397

398398
}
399399

400-
@ResponseStatus(value = HttpStatus.I_AM_A_TEAPOT, reason = "Nope!")
400+
@ResponseStatus(value = HttpStatus.EXPECTATION_FAILED, reason = "Nope!")
401401
static class Custom2Exception extends RuntimeException {
402402

403403
}

smoke-test/spring-boot-smoke-test-actuator/src/main/java/smoketest/actuator/SampleRestControllerEndpointWithException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static class CustomExceptionHandler {
4444

4545
@ExceptionHandler(CustomException.class)
4646
ResponseEntity<String> handleCustomException(CustomException e) {
47-
return new ResponseEntity<>("this is a custom exception body", HttpStatus.I_AM_A_TEAPOT);
47+
return new ResponseEntity<>("this is a custom exception body", HttpStatus.EXPECTATION_FAILED);
4848
}
4949

5050
}

smoke-test/spring-boot-smoke-test-actuator/src/test/java/smoketest/actuator/ManagementDifferentPortAndEndpointWithExceptionHandlerSampleActuatorApplicationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ManagementDifferentPortAndEndpointWithExceptionHandlerSampleActuatorApplic
4545
void testExceptionHandlerRestControllerEndpoint() {
4646
ResponseEntity<String> entity = new TestRestTemplate("user", "password")
4747
.getForEntity("http://localhost:" + this.managementPort + "/actuator/exception", String.class);
48-
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.I_AM_A_TEAPOT);
48+
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.EXPECTATION_FAILED);
4949
assertThat(entity.getBody()).isEqualTo("this is a custom exception body");
5050
}
5151

smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/SampleTomcatApplicationTests.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package smoketest.tomcat;
1818

1919
import java.io.ByteArrayInputStream;
20+
import java.io.IOException;
2021
import java.nio.charset.StandardCharsets;
2122
import java.util.zip.GZIPInputStream;
2223

@@ -28,14 +29,18 @@
2829

2930
import org.springframework.beans.factory.annotation.Autowired;
3031
import org.springframework.beans.factory.annotation.Value;
32+
import org.springframework.boot.http.client.ClientHttpRequestFactoryBuilder;
33+
import org.springframework.boot.restclient.RestTemplateBuilder;
3134
import org.springframework.boot.test.context.SpringBootTest;
3235
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
36+
import org.springframework.boot.test.context.TestConfiguration;
3337
import org.springframework.boot.test.system.CapturedOutput;
3438
import org.springframework.boot.test.system.OutputCaptureExtension;
3539
import org.springframework.boot.tomcat.TomcatWebServer;
3640
import org.springframework.boot.web.server.servlet.context.ServletWebServerApplicationContext;
3741
import org.springframework.boot.web.server.test.client.TestRestTemplate;
3842
import org.springframework.context.ApplicationContext;
43+
import org.springframework.context.annotation.Bean;
3944
import org.springframework.http.HttpEntity;
4045
import org.springframework.http.HttpHeaders;
4146
import org.springframework.http.HttpMethod;
@@ -70,16 +75,18 @@ class SampleTomcatApplicationTests {
7075
void testHome() {
7176
ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
7277
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
78+
assertThat(entity.getHeaders().get(HttpHeaders.CONTENT_ENCODING)).isNull();
7379
assertThat(entity.getBody()).isEqualTo("Hello World");
7480
}
7581

7682
@Test
77-
void testCompression() throws Exception {
83+
void testCompression() throws IOException {
7884
HttpHeaders requestHeaders = new HttpHeaders();
7985
requestHeaders.set("Accept-Encoding", "gzip");
8086
HttpEntity<?> requestEntity = new HttpEntity<>(requestHeaders);
8187
ResponseEntity<byte[]> entity = this.restTemplate.exchange("/", HttpMethod.GET, requestEntity, byte[].class);
8288
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
89+
assertThat(entity.getHeaders().get(HttpHeaders.CONTENT_ENCODING)).containsExactly("gzip");
8390
try (GZIPInputStream inflater = new GZIPInputStream(new ByteArrayInputStream(entity.getBody()))) {
8491
assertThat(StreamUtils.copyToString(inflater, StandardCharsets.UTF_8)).isEqualTo("Hello World");
8592
}
@@ -113,4 +120,15 @@ void testMaxHttpRequestHeaderSize(CapturedOutput output) {
113120
assertThat(output).contains("java.lang.IllegalArgumentException: Request header is too large");
114121
}
115122

123+
@TestConfiguration
124+
static class DisableCompressionConfiguration {
125+
126+
@Bean
127+
RestTemplateBuilder restTemplateBuilder() {
128+
return new RestTemplateBuilder().requestFactoryBuilder(ClientHttpRequestFactoryBuilder.jdk()
129+
.withCustomizer((factory) -> factory.enableCompression(false)));
130+
}
131+
132+
}
133+
116134
}

0 commit comments

Comments
 (0)