Skip to content

Commit 4fb5b87

Browse files
committed
Merge pull request #955 from snicoll
* gh-955: Polish "Raise the minimum support version of Spring Framework to 7.0" Raise the minimum support version of Spring Framework to 7.0 Closes gh-955
2 parents db16f27 + 34c9366 commit 4fb5b87

File tree

24 files changed

+100
-114
lines changed

24 files changed

+100
-114
lines changed

docs/src/docs/asciidoc/documenting-your-api.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,8 +802,6 @@ Uses the static `parameterWithName` method on `org.springframework.restdocs.requ
802802

803803
The result is a snippet named `path-parameters.adoc` that contains a table describing the path parameters that are supported by the resource.
804804

805-
TIP: If you use MockMvc with Spring Framework 6.1 or earlier, to make the path parameters available for documentation, you must build the request by using one of the methods on `RestDocumentationRequestBuilders` rather than `MockMvcRequestBuilders`.
806-
807805
When documenting path parameters, the test fails if an undocumented path parameter is used in the request.
808806
Similarly, the test also fails if a documented path parameter is not found in the request and the path parameter has not been marked as optional.
809807

docs/src/docs/asciidoc/getting-started.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ If you want to jump straight in, a number of https://github.com/spring-projects/
1818
Spring REST Docs has the following minimum requirements:
1919

2020
* Java 17
21-
* Spring Framework 6
21+
* Spring Framework 7
2222

2323
Additionally, the `spring-restdocs-restassured` module requires REST Assured 5.2.
2424

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ org.gradle.parallel=true
66

77
javaFormatVersion=0.0.43
88
jmustacheVersion=1.15
9-
springFrameworkVersion=6.1.13
9+
springFrameworkVersion=7.0.0-M1

spring-restdocs-core/build.gradle

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,3 @@ components.java.withVariantsFromConfiguration(configurations.testFixturesApiElem
8282
components.java.withVariantsFromConfiguration(configurations.testFixturesRuntimeElements) {
8383
skip()
8484
}
85-
86-
compatibilityTest {
87-
dependency("Spring Framework") { springFramework ->
88-
springFramework.groupId = "org.springframework"
89-
springFramework.versions = ["6.0.+", "6.2.+"]
90-
}
91-
}

spring-restdocs-core/src/main/java/org/springframework/restdocs/cli/CliOperationRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2023 the original author or authors.
2+
* Copyright 2014-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -76,7 +76,7 @@ public String getContentAsString() {
7676
@Override
7777
public HttpHeaders getHeaders() {
7878
HttpHeaders filteredHeaders = new HttpHeaders();
79-
for (Entry<String, List<String>> header : this.delegate.getHeaders().entrySet()) {
79+
for (Entry<String, List<String>> header : this.delegate.getHeaders().headerSet()) {
8080
if (allowedHeader(header)) {
8181
filteredHeaders.put(header.getKey(), header.getValue());
8282
}

spring-restdocs-core/src/main/java/org/springframework/restdocs/cli/CurlRequestSnippet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2022 the original author or authors.
2+
* Copyright 2014-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -132,7 +132,7 @@ private void writeHttpMethod(OperationRequest request, StringBuilder builder) {
132132
}
133133

134134
private void writeHeaders(CliOperationRequest request, List<String> lines) {
135-
for (Entry<String, List<String>> entry : request.getHeaders().entrySet()) {
135+
for (Entry<String, List<String>> entry : request.getHeaders().headerSet()) {
136136
for (String header : entry.getValue()) {
137137
if (StringUtils.hasText(request.getContentAsString()) && HttpHeaders.CONTENT_TYPE.equals(entry.getKey())
138138
&& MediaType.APPLICATION_FORM_URLENCODED.equals(request.getHeaders().getContentType())) {

spring-restdocs-core/src/main/java/org/springframework/restdocs/cli/HttpieRequestSnippet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2023 the original author or authors.
2+
* Copyright 2014-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -160,7 +160,7 @@ private void writeFormDataIfNecessary(OperationRequest request, List<String> lin
160160

161161
private void writeHeaders(OperationRequest request, List<String> lines) {
162162
HttpHeaders headers = request.getHeaders();
163-
for (Entry<String, List<String>> entry : headers.entrySet()) {
163+
for (Entry<String, List<String>> entry : headers.headerSet()) {
164164
if (entry.getKey().equals(HttpHeaders.CONTENT_TYPE)
165165
&& headers.getContentType().isCompatibleWith(MediaType.APPLICATION_FORM_URLENCODED)) {
166166
continue;

spring-restdocs-core/src/main/java/org/springframework/restdocs/headers/RequestHeadersSnippet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ protected RequestHeadersSnippet(List<HeaderDescriptor> descriptors, Map<String,
5757

5858
@Override
5959
protected Set<String> extractActualHeaders(Operation operation) {
60-
return operation.getRequest().getHeaders().keySet();
60+
return operation.getRequest().getHeaders().headerNames();
6161
}
6262

6363
/**

spring-restdocs-core/src/main/java/org/springframework/restdocs/headers/ResponseHeadersSnippet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ protected ResponseHeadersSnippet(List<HeaderDescriptor> descriptors, Map<String,
5757

5858
@Override
5959
protected Set<String> extractActualHeaders(Operation operation) {
60-
return operation.getResponse().getHeaders().keySet();
60+
return operation.getResponse().getHeaders().headerNames();
6161
}
6262

6363
/**

spring-restdocs-core/src/main/java/org/springframework/restdocs/http/HttpRequestSnippet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2024 the original author or authors.
2+
* Copyright 2014-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -91,7 +91,7 @@ private boolean includeParametersInUri(OperationRequest request) {
9191
private List<Map<String, String>> getHeaders(OperationRequest request) {
9292
List<Map<String, String>> headers = new ArrayList<>();
9393

94-
for (Entry<String, List<String>> header : request.getHeaders().entrySet()) {
94+
for (Entry<String, List<String>> header : request.getHeaders().headerSet()) {
9595
for (String value : header.getValue()) {
9696
if (HttpHeaders.CONTENT_TYPE.equals(header.getKey()) && !request.getParts().isEmpty()) {
9797
headers.add(header(header.getKey(), String.format("%s; boundary=%s", value, MULTIPART_BOUNDARY)));

0 commit comments

Comments
 (0)