Skip to content

Commit 50771a9

Browse files
committed
Init 5.0.x.
1 parent 94b07a5 commit 50771a9

File tree

9 files changed

+34
-16
lines changed

9 files changed

+34
-16
lines changed

docs/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>org.springframework.cloud</groupId>
1010
<artifactId>spring-cloud-openfeign</artifactId>
11-
<version>4.3.1-SNAPSHOT</version>
11+
<version>5.0.0-SNAPSHOT</version>
1212
<relativePath>..</relativePath>
1313
</parent>
1414
<scm>

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66
<artifactId>spring-cloud-openfeign</artifactId>
7-
<version>4.3.1-SNAPSHOT</version>
7+
<version>5.0.0-SNAPSHOT</version>
88
<packaging>pom</packaging>
99
<name>Spring Cloud OpenFeign</name>
1010
<description>Spring Cloud OpenFeign</description>
1111
<parent>
1212
<groupId>org.springframework.cloud</groupId>
1313
<artifactId>spring-cloud-build</artifactId>
14-
<version>4.3.1-SNAPSHOT</version>
14+
<version>5.0.0-SNAPSHOT</version>
1515
<relativePath/>
1616
</parent>
1717
<scm>
@@ -26,7 +26,7 @@
2626
<properties>
2727
<main.basedir>${basedir}</main.basedir>
2828
<jackson.version>2.19.0</jackson.version>
29-
<spring-cloud-commons.version>4.3.1-SNAPSHOT</spring-cloud-commons.version>
29+
<spring-cloud-commons.version>5.0.0-SNAPSHOT</spring-cloud-commons.version>
3030

3131
<!-- Plugin versions -->
3232
<maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>

spring-cloud-openfeign-core/pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.cloud</groupId>
88
<artifactId>spring-cloud-openfeign</artifactId>
9-
<version>4.3.1-SNAPSHOT</version>
9+
<version>5.0.0-SNAPSHOT</version>
1010
<relativePath>..</relativePath> <!-- lookup parent from repository -->
1111
</parent>
1212
<scm>
@@ -64,6 +64,10 @@
6464
<artifactId>reactor-core</artifactId>
6565
<optional>true</optional>
6666
</dependency>
67+
<dependency>
68+
<groupId>org.jspecify</groupId>
69+
<artifactId>jspecify</artifactId>
70+
</dependency>
6771
<dependency>
6872
<groupId>org.springframework.retry</groupId>
6973
<artifactId>spring-retry</artifactId>

spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/FeignClientFactory.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@
1919
import java.util.HashMap;
2020
import java.util.Map;
2121

22+
import org.jspecify.annotations.Nullable;
23+
2224
import org.springframework.beans.BeansException;
2325
import org.springframework.beans.factory.BeanFactoryUtils;
2426
import org.springframework.cloud.context.named.NamedContextFactory;
2527
import org.springframework.context.ApplicationContextInitializer;
2628
import org.springframework.context.support.GenericApplicationContext;
27-
import org.springframework.lang.Nullable;
2829

2930
/**
3031
* A factory that creates instances of feign classes. It creates a Spring
@@ -48,8 +49,7 @@ public FeignClientFactory(
4849
applicationContextInitializers);
4950
}
5051

51-
@Nullable
52-
public <T> T getInstanceWithoutAncestors(String name, Class<T> type) {
52+
public <T> @Nullable T getInstanceWithoutAncestors(String name, Class<T> type) {
5353
try {
5454
return BeanFactoryUtils.beanOfType(getContext(name), type);
5555
}
@@ -58,8 +58,7 @@ public <T> T getInstanceWithoutAncestors(String name, Class<T> type) {
5858
}
5959
}
6060

61-
@Nullable
62-
public <T> Map<String, T> getInstancesWithoutAncestors(String name, Class<T> type) {
61+
@Nullable public <T> Map<String, T> getInstancesWithoutAncestors(String name, Class<T> type) {
6362
return getContext(name).getBeansOfType(type);
6463
}
6564

spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/support/SpringEncoder.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
import org.springframework.http.converter.HttpMessageConversionException;
4949
import org.springframework.http.converter.HttpMessageConverter;
5050
import org.springframework.http.converter.protobuf.ProtobufHttpMessageConverter;
51+
import org.springframework.util.LinkedMultiValueMap;
52+
import org.springframework.util.MultiValueMap;
5153
import org.springframework.web.multipart.MultipartFile;
5254

5355
import static org.springframework.cloud.openfeign.support.FeignUtils.getHttpHeaders;
@@ -140,7 +142,13 @@ private void encodeWithMessageConverter(Object requestBody, Type bodyType, Reque
140142
request.headers(null);
141143
// converters can modify headers, so update the request
142144
// with the modified headers
143-
request.headers(new LinkedHashMap<>(outputMessage.getHeaders()));
145+
146+
MultiValueMap<String, String> newHeaders = new LinkedMultiValueMap<>();
147+
if (outputMessage.getHeaders() != null) {
148+
outputMessage.getHeaders().forEach(newHeaders::put);
149+
}
150+
151+
request.headers(new LinkedHashMap<>(newHeaders));
144152

145153
// do not use charset for binary data and protobuf
146154
Charset charset;

spring-cloud-openfeign-core/src/test/java/org/springframework/cloud/openfeign/FeignClientFactoryBeanIntegrationTests.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.cloud.openfeign;
1818

19-
import java.util.HashMap;
2019
import java.util.List;
2120
import java.util.Map;
2221

@@ -39,6 +38,8 @@
3938
import org.springframework.http.HttpStatus;
4039
import org.springframework.http.ResponseEntity;
4140
import org.springframework.test.context.ActiveProfiles;
41+
import org.springframework.util.LinkedMultiValueMap;
42+
import org.springframework.util.MultiValueMap;
4243
import org.springframework.web.bind.annotation.GetMapping;
4344
import org.springframework.web.bind.annotation.RequestHeader;
4445
import org.springframework.web.bind.annotation.RequestMapping;
@@ -129,7 +130,11 @@ protected static class Application {
129130

130131
@GetMapping(value = "/headers", produces = APPLICATION_JSON_VALUE)
131132
public Map<String, List<String>> headers(@RequestHeader HttpHeaders headers) {
132-
return new HashMap<>(headers);
133+
MultiValueMap<String, String> newHeaders = new LinkedMultiValueMap<>();
134+
if (headers != null) {
135+
headers.forEach(newHeaders::put);
136+
}
137+
return newHeaders;
133138
}
134139

135140
@GetMapping(value = "/params", produces = APPLICATION_JSON_VALUE)

spring-cloud-openfeign-dependencies/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
<parent>
77
<artifactId>spring-cloud-dependencies-parent</artifactId>
88
<groupId>org.springframework.cloud</groupId>
9-
<version>4.3.1-SNAPSHOT</version>
9+
<version>5.0.0-SNAPSHOT</version>
1010
<relativePath/>
1111
</parent>
1212
<artifactId>spring-cloud-openfeign-dependencies</artifactId>
13-
<version>4.3.1-SNAPSHOT</version>
13+
<version>5.0.0-SNAPSHOT</version>
1414
<packaging>pom</packaging>
1515
<name>spring-cloud-openfeign-dependencies</name>
1616
<description>Spring Cloud OpenFeign Dependencies</description>

spring-cloud-starter-openfeign/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.cloud</groupId>
77
<artifactId>spring-cloud-openfeign</artifactId>
8-
<version>4.3.1-SNAPSHOT</version>
8+
<version>5.0.0-SNAPSHOT</version>
99
<relativePath>..</relativePath>
1010
</parent>
1111
<scm>

src/checkstyle/checkstyle-suppressions.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@
2222
<suppress files="Request\.java" checks="[a-zA-Z0-9]*"/>
2323
<suppress files="RequestOrBuilder\.java" checks="[a-zA-Z0-9]*"/>
2424
<suppress files="ProtobufTest\.java" checks="[a-zA-Z0-9]*"/>
25+
<!-- Portfolio convention for @Nullable is now to inline it-->
26+
<suppress files=".*" checks="AnnotationLocation"/>
2527
</suppressions>

0 commit comments

Comments
 (0)