diff --git a/grpc-client-spring-boot-starter/src/main/java/net/devh/boot/grpc/client/config/GrpcChannelProperties.java b/grpc-client-spring-boot-starter/src/main/java/net/devh/boot/grpc/client/config/GrpcChannelProperties.java index 22994b5a5..2d06a4e2c 100644 --- a/grpc-client-spring-boot-starter/src/main/java/net/devh/boot/grpc/client/config/GrpcChannelProperties.java +++ b/grpc-client-spring-boot-starter/src/main/java/net/devh/boot/grpc/client/config/GrpcChannelProperties.java @@ -501,6 +501,9 @@ public void copyDefaultsFrom(final GrpcChannelProperties config) { if (this.maxInboundMessageSize == null) { this.maxInboundMessageSize = config.maxInboundMessageSize; } + if (this.maxInboundMetadataSize == null) { + this.maxInboundMetadataSize = config.maxInboundMetadataSize; + } if (this.negotiationType == null) { this.negotiationType = config.negotiationType; } diff --git a/grpc-client-spring-boot-starter/src/test/java/net/devh/boot/grpc/client/config/GrpcChannelPropertiesGlobalTest.java b/grpc-client-spring-boot-starter/src/test/java/net/devh/boot/grpc/client/config/GrpcChannelPropertiesGlobalTest.java index 162c6b715..dfe569f11 100644 --- a/grpc-client-spring-boot-starter/src/test/java/net/devh/boot/grpc/client/config/GrpcChannelPropertiesGlobalTest.java +++ b/grpc-client-spring-boot-starter/src/test/java/net/devh/boot/grpc/client/config/GrpcChannelPropertiesGlobalTest.java @@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.util.unit.DataSize; /** * Tests whether the global property fallback works. @@ -34,6 +35,8 @@ @SpringBootTest(properties = { "grpc.client.GLOBAL.keepAliveTime=23m", "grpc.client.GLOBAL.keepAliveTimeout=31s", + "grpc.client.GLOBAL.maxInboundMessageSize=5MB", + "grpc.client.GLOBAL.maxInboundMetadataSize=3MB", "grpc.client.test.keepAliveTime=42m"}) class GrpcChannelPropertiesGlobalTest { @@ -52,4 +55,11 @@ void test() { assertEquals(Duration.ofSeconds(31), this.grpcChannelsProperties.getChannel("test").getKeepAliveTimeout()); } + @Test + void testCopyDefaults() { + assertEquals(DataSize.ofMegabytes(5), + this.grpcChannelsProperties.getChannel("test").getMaxInboundMessageSize()); + assertEquals(DataSize.ofMegabytes(3), + this.grpcChannelsProperties.getChannel("test").getMaxInboundMetadataSize()); + } }