Skip to content

Commit d2348ce

Browse files
committed
Add grpc-client using grpc-server in readme
- Remove unused properties from application.properties and test - Simplify exclusion for netty in tests - Update javadoc for Applicaition.java to be 3rd person narrative
1 parent 3d28986 commit d2348ce

5 files changed

Lines changed: 24 additions & 17 deletions

File tree

basic/grpc-server/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,21 @@ The sample uses a simple greeting service defined in a Protocol Buffers (protobu
1414

1515
### Command Line Using Gradle
1616

17+
To start the gRPC server application using Spring Boot run the following:
18+
1719
$ gradlew :grpc-server:bootRun
1820

19-
This will start the gRPC server application using Spring Boot.
21+
To test the gRPC server application run the gRPC client sample using Spring Boot run as follows:
22+
23+
$ gradlew :grpc-client:bootRun
24+
25+
You should see output that looks like the following:
26+
27+
```log
28+
2026-03-25T11:10:18.538-04:00 INFO 91646 --- [ main] o.s.i.s.g.c.GrpcClientConfiguration : Single response reply: Hello Jack
29+
2026-03-25T11:10:18.544-04:00 INFO 91646 --- [ault-executor-0] o.s.i.s.g.c.GrpcClientConfiguration : Stream received reply: Hello Stream Jane
30+
2026-03-25T11:10:18.545-04:00 INFO 91646 --- [ault-executor-0] o.s.i.s.g.c.GrpcClientConfiguration : Stream received reply: Hello again!
31+
```
2032

2133
## Testing the sample
2234

basic/grpc-server/src/main/java/org/springframework/integration/samples/grpc/server/Application.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import org.springframework.boot.autoconfigure.SpringBootApplication;
2121

2222
/**
23-
* Demonstrate Spring Integration's
23+
* The Spring Boot application to demonstrate Spring Integration's
2424
* {@link org.springframework.integration.grpc.inbound.GrpcInboundGateway} support.
2525
*
2626
* @author Glenn Renfro

basic/grpc-server/src/main/resources/application.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.

basic/grpc-server/src/test/java/org/springframework/integration/samples/grpc/server/GrpcServerTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939
* @author Glenn Renfro
4040
*/
4141
@SpringBootTest({
42-
"spring.grpc.server.inprocess.name=test",
43-
"spring.grpc.client.channels.spring-integration.address=in-process:test"
42+
"spring.grpc.server.inprocess.name=test"
4443
})
4544
@ImportGrpcClients(
4645
types = {
@@ -88,8 +87,9 @@ void serverStreaming() throws InterruptedException {
8887

8988
assertThat(replyLatch.await(10_000, TimeUnit.MILLISECONDS)).isTrue();
9089

91-
assertThat(replies.get(0)).extracting(HelloReply::getMessage).isEqualTo("Hello Stream Jane");
92-
assertThat(replies.get(1)).extracting(HelloReply::getMessage).isEqualTo("Hello again!");
90+
assertThat(replies)
91+
.extracting(HelloReply::getMessage)
92+
.containsOnly("Hello Stream Jane", "Hello again!");
9393
}
9494

9595
/**

build.gradle

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -891,10 +891,8 @@ project('grpc-client') {
891891
implementation 'org.springframework.integration:spring-integration-grpc'
892892

893893
//Test
894-
testImplementation "org.springframework.boot:spring-boot-starter-grpc-test"
895-
896-
configurations {
897-
testRuntimeOnly.exclude group: 'io.grpc', module: 'grpc-netty'
894+
testImplementation ('org.springframework.boot:spring-boot-starter-grpc-test') {
895+
exclude group: 'io.grpc', module: 'grpc-netty'
898896
}
899897
}
900898

@@ -926,11 +924,11 @@ project('grpc-client') {
926924
}
927925

928926
springBoot {
929-
mainClass = 'org.springframework.integration.samples.Application'
927+
mainClass = 'org.springframework.integration.samples.grpc.client.Application'
930928
}
931929

932930
tasks.register('run', JavaExec) {
933-
mainClass = 'org.springframework.integration.samples.Application'
931+
mainClass = 'org.springframework.integration.samples.grpc.client.Application'
934932
classpath = sourceSets.main.runtimeClasspath
935933
}
936934

@@ -948,10 +946,8 @@ project('grpc-server') {
948946
implementation 'org.springframework.integration:spring-integration-grpc'
949947

950948
//Test
951-
testImplementation "org.springframework.boot:spring-boot-starter-grpc-test"
952-
953-
configurations {
954-
testRuntimeOnly.exclude group: 'io.grpc', module: 'grpc-netty'
949+
testImplementation ('org.springframework.boot:spring-boot-starter-grpc-test') {
950+
exclude group: 'io.grpc', module: 'grpc-netty'
955951
}
956952
}
957953

0 commit comments

Comments
 (0)