Skip to content

Commit c666b01

Browse files
authored
Merge pull request #583 from luankevinferreira/bump-grpc
2 parents 1f76160 + 2eb91e9 commit c666b01

File tree

5 files changed

+6
-17
lines changed

5 files changed

+6
-17
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ buildscript {
1212
projectVersion = '2.13.0-SNAPSHOT'
1313

1414
// https://github.com/grpc/grpc-java/releases
15-
grpcVersion = '1.37.0'
15+
grpcVersion = '1.40.1'
1616

1717
// https://github.com/google/guava/releases
1818
guavaVersion = '30.1.1-jre'

docs/en/client/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ There are a number of supported schemes, that you can use to determine the targe
7575
The self address or scheme is a keyword that is available, if you also use `grpc-server-spring-boot-starter` and
7676
allows you to connect to the server without specifying the own address/port. This is especially useful for tests
7777
where you might want to use random server ports to avoid conflicts. \
78-
Example: `self` or `self:self`
78+
Example: `self:self`
7979
- `in-process`: \
8080
This is a special scheme that will bypass the normal channel factory and will use the `InProcessChannelFactory`
8181
instead. Use it to connect to the [`InProcessServer`](../server/configuration.md#enabling-the-inprocessserver). \

docs/zh-CN/client/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ grpc.client.__name__.address=static://localhost:9090
4545
- `static`(优先级 4): 一个简单的IP静态列表 (v4 和 v6), 可用于连接到服务端 (支持 `localhost`)。 例如:`static://192.168.1:8080,10.0.0.1:1337`
4646
- [`dns`](https://github.com/grpc/grpc-java/blob/master/core/src/main/java/io/grpc/internal/DnsNameResolver.java#L66)(优先级 5):解析并绑定到给定 DNS 名称的所有地址。 地址将被缓存,只有当现有连接被关闭 / 失败时才会刷新。 更多选项,例如 `SVC` 查找(对 kubernetes 有用),可以通过系统属性启用。 例如:`dns:///example.my.company`
4747
- `discovery` (优先级 6):(可选) 使用 Spring Cloud 的`DiscoveryClient` 去查找合适的目标。 在 `HeartbeatEvent` 的时候,连接将自动刷新。 使用 `gRPC_port` 元数据来确定端口,否则使用服务端口。 示例: `discovery:///service-name`
48-
- `self`(优先级 0):如果您使用 `grpc-server-spring-boot-starter` 并且不想指定自己的地址 / 端口,则可以使用 self 关键词作为 scheme 或者 address 。 这对于需要使用随机服务器端口以避免冲突的测试特别有用。 例如:`self``self:self`
48+
- `self`(优先级 0):如果您使用 `grpc-server-spring-boot-starter` 并且不想指定自己的地址 / 端口,则可以使用 self 关键词作为 scheme 或者 address 。 这对于需要使用随机服务器端口以避免冲突的测试特别有用。 例如:`self:self`
4949
- `in-process`:这是一个特殊的方案,将使用 `InProcessChannelFactory` 来替代原有正常的 ChannelFactory。 并使用它连接到 [`InProcessServer`](../server/configuration.md#enabling-the-inprocessserver)。 例如:`in-process:foobar`
5050
- *custom*: 您可以通过 Java 的 `ServiceLoader` 或从 Spring 的应用上下文中选择要自定义的 [`NameResolverProvider`](https://javadoc.io/page/io.grpc/grpc-all/latest/io/grpc/NameResolverProvider.html) ,并将其注册到 `NameResolverRegistry` 上.
5151

grpc-server-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/server/nameresolver/SelfNameResolverFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public SelfNameResolverFactory(final GrpcServerProperties properties) {
5050

5151
@Override
5252
public NameResolver newNameResolver(final URI targetUri, final Args args) {
53-
if (SELF_SCHEME.equals(targetUri.getScheme()) || targetUri.toString().equals(SELF_SCHEME)) {
53+
if (SELF_SCHEME.equals(targetUri.getScheme())) {
5454
return new SelfNameResolver(this.properties, args);
5555
}
5656
return null;

tests/src/test/java/net/devh/boot/grpc/test/setup/SelfNameResolverConnectionTest.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,17 @@
4040
@SpringBootTest(properties = {
4141
"grpc.server.port=0",
4242
"grpc.client.GLOBAL.negotiationType=PLAINTEXT",
43-
"grpc.client.other.address=self",
43+
"grpc.client.test.address=self:self",
4444
})
4545
@SpringJUnitConfig(classes = {ServiceConfiguration.class, BaseAutoConfiguration.class})
4646
@DirtiesContext
4747
public class SelfNameResolverConnectionTest {
4848

4949
private static final Empty EMPTY = Empty.getDefaultInstance();
5050

51-
@GrpcClient("self")
51+
@GrpcClient("test")
5252
private TestServiceBlockingStub selfStub;
5353

54-
@GrpcClient("other")
55-
private TestServiceBlockingStub otherStub;
56-
5754
/**
5855
* Tests the connection via the implicit client address.
5956
*/
@@ -62,12 +59,4 @@ public void testSelfConnection() {
6259
assertEquals("1.2.3", this.selfStub.normal(EMPTY).getVersion());
6360
}
6461

65-
/**
66-
* Tests the connection via the explicit client address.
67-
*/
68-
@Test
69-
public void testOtherConnection() {
70-
assertEquals("1.2.3", this.otherStub.normal(EMPTY).getVersion());
71-
}
72-
7362
}

0 commit comments

Comments
 (0)