Skip to content

Commit c3d8372

Browse files
committed
Fix serviceConfig within scope of copy
Signed-off-by: NeatGuyCoding <[email protected]>
1 parent 05f0758 commit c3d8372

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

spring-grpc-spring-boot-autoconfigure/src/main/java/org/springframework/grpc/autoconfigure/client/GrpcClientProperties.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ public Health getHealth() {
153153
/**
154154
* Map representation of the service config to use for the channel
155155
*/
156-
private final Map<String, ?> serviceConfig = new HashMap<>();
156+
private final Map<String, Object> serviceConfig = new HashMap<>();
157157

158-
public Map<String, ?> getServiceConfig() {
158+
public Map<String, Object> getServiceConfig() {
159159
return this.serviceConfig;
160160
}
161161

@@ -349,6 +349,8 @@ public ChannelConfig copy() {
349349
copy.defaultDeadline = this.defaultDeadline;
350350
copy.health.copyValuesFrom(this.getHealth());
351351
copy.ssl.copyValuesFrom(this.getSsl());
352+
copy.serviceConfig.clear();
353+
copy.serviceConfig.putAll(this.serviceConfig);
352354
return copy;
353355
}
354356

spring-grpc-spring-boot-autoconfigure/src/test/java/org/springframework/grpc/autoconfigure/client/GrpcClientPropertiesTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ void copyFromDefaultChannel() {
289289
var defaultChannel = properties.getDefaultChannel();
290290
var newChannel = defaultChannel.copy();
291291
assertThat(newChannel).usingRecursiveComparison().isEqualTo(defaultChannel);
292+
assertThat(newChannel.getServiceConfig()).isEqualTo(defaultChannel.getServiceConfig());
292293
}
293294

294295
}

0 commit comments

Comments
 (0)