Skip to content

Commit 5ab487f

Browse files
dsyerphilwebb
andcommitted
Update samples to use Spring Boot 4.1
Co-authored-by: Phillip Webb <phil.webb@broadcom.com>
1 parent f8cae37 commit 5ab487f

30 files changed

Lines changed: 100 additions & 182 deletions

File tree

samples/grpc-client/pom.xml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>4.1.0-GRPC-SNAPSHOT</version>
9+
<version>4.1.0-SNAPSHOT</version>
1010
<relativePath /> <!-- lookup parent from repository -->
1111
</parent>
1212
<groupId>org.springframework.grpc</groupId>
@@ -30,8 +30,6 @@
3030
<properties>
3131
<java.version>17</java.version>
3232
<spring-javaformat-maven-plugin.version>0.0.43</spring-javaformat-maven-plugin.version>
33-
<protobuf-java.version>4.34.0</protobuf-java.version>
34-
<grpc.version>1.79.0</grpc.version>
3533
<maven.version>3.9.4</maven.version>
3634
<maven.resolver.version>1.9.18</maven.resolver.version>
3735
</properties>
@@ -111,18 +109,6 @@
111109
<plugin>
112110
<groupId>io.github.ascopes</groupId>
113111
<artifactId>protobuf-maven-plugin</artifactId>
114-
<version>4.0.3</version>
115-
<configuration>
116-
<protocVersion>${protobuf-java.version}</protocVersion>
117-
<binaryMavenPlugins>
118-
<binaryMavenPlugin>
119-
<groupId>io.grpc</groupId>
120-
<artifactId>protoc-gen-grpc-java</artifactId>
121-
<version>${grpc.version}</version>
122-
<options>@generated=omit</options>
123-
</binaryMavenPlugin>
124-
</binaryMavenPlugins>
125-
</configuration>
126112
<executions>
127113
<execution>
128114
<goals>

samples/grpc-client/src/test/java/org/springframework/grpc/sample/DefaultDeadlineSetupTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import java.io.File;
77

88
import org.junit.jupiter.api.Assertions;
9-
import org.junit.jupiter.api.Disabled;
109
import org.junit.jupiter.api.Nested;
1110
import org.junit.jupiter.api.Test;
1211
import org.junit.jupiter.api.condition.EnabledIf;
@@ -28,11 +27,10 @@
2827
import io.grpc.StatusRuntimeException;
2928

3029
@ImportGrpcClients
31-
@Disabled("Need to migrate to Spring Boot 4.1.x")
3230
public class DefaultDeadlineSetupTests {
3331

3432
@Nested
35-
@SpringBootTest(properties = "spring.grpc.client.channel.default.default-deadline=1s")
33+
@SpringBootTest(properties = "spring.grpc.client.channel.default.default.deadline=1s")
3634
@DirtiesContext
3735
@EnabledIf("serverJarAvailable")
3836
class Deadline {
@@ -80,7 +78,7 @@ public CommandLineRunner otherRunner(SimpleGrpc.SimpleBlockingStub stub) {
8078
}
8179

8280
@Nested
83-
@SpringBootTest(properties = "spring.grpc.client.channel.default.default-deadline=1s")
81+
@SpringBootTest(properties = "spring.grpc.client.channel.default.default.deadline=1s")
8482
@DirtiesContext
8583
@EnabledIf("serverJarAvailable")
8684
class WithoutDeadline {

samples/grpc-oauth2/pom.xml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>4.1.0-GRPC-SNAPSHOT</version>
9+
<version>4.1.0-SNAPSHOT</version>
1010
<relativePath /> <!-- lookup parent from repository -->
1111
</parent>
1212
<groupId>org.springframework.grpc</groupId>
@@ -30,8 +30,6 @@
3030
<properties>
3131
<java.version>17</java.version>
3232
<spring-javaformat-maven-plugin.version>0.0.43</spring-javaformat-maven-plugin.version>
33-
<protobuf-java.version>4.34.0</protobuf-java.version>
34-
<grpc.version>1.79.0</grpc.version>
3533
</properties>
3634
<dependencyManagement>
3735
<dependencies>
@@ -116,18 +114,6 @@
116114
<plugin>
117115
<groupId>io.github.ascopes</groupId>
118116
<artifactId>protobuf-maven-plugin</artifactId>
119-
<version>4.0.3</version>
120-
<configuration>
121-
<protocVersion>${protobuf-java.version}</protocVersion>
122-
<binaryMavenPlugins>
123-
<binaryMavenPlugin>
124-
<groupId>io.grpc</groupId>
125-
<artifactId>protoc-gen-grpc-java</artifactId>
126-
<version>${grpc.version}</version>
127-
<options>@generated=omit</options>
128-
</binaryMavenPlugin>
129-
</binaryMavenPlugins>
130-
</configuration>
131117
<executions>
132118
<execution>
133119
<goals>

samples/grpc-oauth2/src/test/java/org/springframework/grpc/sample/GrpcServerApplicationTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import java.util.concurrent.atomic.AtomicReference;
88

99
import org.awaitility.Awaitility;
10-
import org.junit.jupiter.api.Disabled;
1110
import org.junit.jupiter.api.Test;
1211
import org.springframework.beans.factory.ObjectProvider;
1312
import org.springframework.beans.factory.annotation.Autowired;
@@ -39,10 +38,11 @@
3938
import io.grpc.reflection.v1.ServerReflectionResponse;
4039
import io.grpc.stub.StreamObserver;
4140

42-
@SpringBootTest(properties = { "spring.grpc.server.address=0.0.0.0:0",
43-
"spring.grpc.client.channel.default.target=static://0.0.0.0:${local.grpc.sever.port}" })
41+
@SpringBootTest(properties = { "spring.grpc.server.port=0",
42+
"spring.grpc.client.channel.default.target=0.0.0.0:${local.grpc.server.port}",
43+
"spring.grpc.client.channel.stub.target=0.0.0.0:${local.grpc.server.port}",
44+
"spring.grpc.client.channel.secure.target=0.0.0.0:${local.grpc.server.port}" })
4445
@DirtiesContext
45-
@Disabled("Need to migrate to Spring Boot 4.1.x")
4646
public class GrpcServerApplicationTests {
4747

4848
public static void main(String[] args) {

samples/grpc-reactive/pom.xml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>4.1.0-GRPC-SNAPSHOT</version>
9+
<version>4.1.0-SNAPSHOT</version>
1010
<relativePath /> <!-- lookup parent from repository -->
1111
</parent>
1212
<groupId>org.springframework.grpc</groupId>
@@ -30,8 +30,6 @@
3030
<properties>
3131
<java.version>17</java.version>
3232
<spring-javaformat-maven-plugin.version>0.0.43</spring-javaformat-maven-plugin.version>
33-
<protobuf-java.version>4.34.0</protobuf-java.version>
34-
<grpc.version>1.79.0</grpc.version>
3533
</properties>
3634
<dependencyManagement>
3735
<dependencies>
@@ -133,25 +131,24 @@
133131
<plugin>
134132
<groupId>io.github.ascopes</groupId>
135133
<artifactId>protobuf-maven-plugin</artifactId>
136-
<version>4.0.3</version>
134+
137135
<configuration>
138-
<protocVersion>${protobuf-java.version}</protocVersion>
139-
<binaryMavenPlugins>
140-
<binaryMavenPlugin>
136+
<protoc>${protobuf-java.version}</protoc>
137+
<plugins>
138+
<plugin kind="binary-maven">
141139
<groupId>io.grpc</groupId>
142140
<artifactId>protoc-gen-grpc-java</artifactId>
143-
<version>${grpc.version}</version>
141+
<version>${grpc-java.version}</version>
144142
<options>@generated=omit</options>
145-
</binaryMavenPlugin>
146-
</binaryMavenPlugins>
147-
<jvmMavenPlugins>
148-
<jvmMavenPlugin>
143+
</plugin>
144+
<plugin kind="jvm-maven">
149145
<groupId>com.salesforce.servicelibs</groupId>
150146
<artifactId>reactor-grpc</artifactId>
151147
<version>1.2.4</version>
152-
</jvmMavenPlugin>
153-
</jvmMavenPlugins>
148+
</plugin>
149+
</plugins>
154150
</configuration>
151+
155152
<executions>
156153
<execution>
157154
<goals>

samples/grpc-secure/pom.xml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>4.1.0-GRPC-SNAPSHOT</version>
9+
<version>4.1.0-SNAPSHOT</version>
1010
<relativePath /> <!-- lookup parent from repository -->
1111
</parent>
1212
<groupId>org.springframework.grpc</groupId>
@@ -30,8 +30,6 @@
3030
<properties>
3131
<java.version>17</java.version>
3232
<spring-javaformat-maven-plugin.version>0.0.43</spring-javaformat-maven-plugin.version>
33-
<protobuf-java.version>4.34.0</protobuf-java.version>
34-
<grpc.version>1.79.0</grpc.version>
3533
</properties>
3634
<dependencyManagement>
3735
<dependencies>
@@ -105,18 +103,6 @@
105103
<plugin>
106104
<groupId>io.github.ascopes</groupId>
107105
<artifactId>protobuf-maven-plugin</artifactId>
108-
<version>4.0.3</version>
109-
<configuration>
110-
<protocVersion>${protobuf-java.version}</protocVersion>
111-
<binaryMavenPlugins>
112-
<binaryMavenPlugin>
113-
<groupId>io.grpc</groupId>
114-
<artifactId>protoc-gen-grpc-java</artifactId>
115-
<version>${grpc.version}</version>
116-
<options>@generated=omit</options>
117-
</binaryMavenPlugin>
118-
</binaryMavenPlugins>
119-
</configuration>
120106
<executions>
121107
<execution>
122108
<goals>

samples/grpc-secure/src/test/java/org/springframework/grpc/sample/GrpcServerApplicationTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import java.util.concurrent.atomic.AtomicReference;
88

99
import org.awaitility.Awaitility;
10-
import org.junit.jupiter.api.Disabled;
1110
import org.junit.jupiter.api.Test;
1211
import org.springframework.beans.factory.annotation.Autowired;
1312
import org.springframework.beans.factory.annotation.Qualifier;
@@ -30,10 +29,11 @@
3029
import io.grpc.reflection.v1.ServerReflectionResponse;
3130
import io.grpc.stub.StreamObserver;
3231

33-
@SpringBootTest(properties = { "spring.grpc.server.address=0.0.0.0:0",
34-
"spring.grpc.client.channel.default.target=static://0.0.0.0:${local.grpc.sever.port}" })
32+
@SpringBootTest(properties = { "spring.grpc.server.port=0",
33+
"spring.grpc.client.channel.default.target=static://0.0.0.0:${local.grpc.server.port}",
34+
"spring.grpc.client.channel.stub.target=static://0.0.0.0:${local.grpc.server.port}",
35+
"spring.grpc.client.channel.secure.target=static://0.0.0.0:${local.grpc.server.port}" })
3536
@DirtiesContext
36-
@Disabled("Need to migrate to Spring Boot 4.1.x")
3737
public class GrpcServerApplicationTests {
3838

3939
public static void main(String[] args) {

samples/grpc-server-kotlin/pom.xml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>4.1.0-GRPC-SNAPSHOT</version>
9+
<version>4.1.0-SNAPSHOT</version>
1010
<relativePath /> <!-- lookup parent from repository -->
1111
</parent>
1212
<groupId>org.springframework.grpc</groupId>
@@ -30,10 +30,6 @@
3030
<properties>
3131
<java.version>17</java.version>
3232
<spring-javaformat-maven-plugin.version>0.0.43</spring-javaformat-maven-plugin.version>
33-
<protobuf-java.version>4.34.0</protobuf-java.version>
34-
<grpc.version>1.79.0</grpc.version>
35-
<grpc.kotlin.version>1.5.0</grpc.kotlin.version>
36-
<kotlin.version>2.2.21</kotlin.version>
3733
</properties>
3834
<dependencyManagement>
3935
<dependencies>
@@ -66,7 +62,6 @@
6662
<dependency>
6763
<groupId>io.grpc</groupId>
6864
<artifactId>grpc-kotlin-stub</artifactId>
69-
<version>${grpc.kotlin.version}</version>
7065
</dependency>
7166
<dependency>
7267
<groupId>io.micrometer</groupId>
@@ -94,7 +89,6 @@
9489
<plugin>
9590
<groupId>org.jetbrains.kotlin</groupId>
9691
<artifactId>kotlin-maven-plugin</artifactId>
97-
<version>${kotlin.version}</version>
9892
<executions>
9993
<execution>
10094
<id>compile</id>
@@ -148,28 +142,24 @@
148142
<plugin>
149143
<groupId>io.github.ascopes</groupId>
150144
<artifactId>protobuf-maven-plugin</artifactId>
151-
<version>4.0.3</version>
152145
<configuration>
153-
<protocVersion>${protobuf-java.version}</protocVersion>
154-
<binaryMavenPlugins>
155-
<binaryMavenPlugin>
146+
<protoc>${protobuf-java.version}</protoc>
147+
<plugins>
148+
<plugin kind="binary-maven">
156149
<groupId>io.grpc</groupId>
157150
<artifactId>protoc-gen-grpc-java</artifactId>
158-
<version>${grpc.version}</version>
151+
<version>${grpc-java.version}</version>
159152
<options>@generated=omit</options>
160-
</binaryMavenPlugin>
161-
</binaryMavenPlugins>
162-
<jvmMavenPlugins>
163-
<jvmMavenPlugin>
153+
</plugin>
154+
<plugin kind="jvm-maven">
164155
<groupId>io.grpc</groupId>
165156
<artifactId>protoc-gen-grpc-kotlin</artifactId>
166-
<version>${grpc.kotlin.version}</version>
157+
<version>${grpc-kotlin.version}</version>
167158
<classifier>jdk8</classifier>
168159
<type>jar</type>
169-
<mainClass>io.grpc.kotlin.generator.GeneratorRunner</mainClass>
170160
<options>@generated=omit</options>
171-
</jvmMavenPlugin>
172-
</jvmMavenPlugins>
161+
</plugin>
162+
</plugins>
173163
</configuration>
174164
<executions>
175165
<execution>

samples/grpc-server-kotlin/src/main/kotlin/org/springframework/grpc/sample/GrpcServerApplication.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication
55
import org.springframework.boot.runApplication
66
import org.springframework.context.annotation.Bean
77
import org.springframework.grpc.server.exception.GrpcExceptionHandler
8+
import org.springframework.grpc.client.ImportGrpcClients;
9+
import org.springframework.grpc.sample.proto.SimpleGrpc;
810

911
@SpringBootApplication
12+
@ImportGrpcClients(basePackageClasses = [SimpleGrpc::class])
1013
open class GrpcServerApplication {
1114

1215
@Bean

samples/grpc-server-kotlin/src/test/kotlin/org/springframework/grpc/sample/GrpcServerApplicationTests.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ import org.springframework.test.annotation.DirtiesContext
1313

1414
@SpringBootTest(
1515
properties = [
16-
"spring.grpc.server.address=0.0.0.0:0",
17-
"spring.grpc.client.channel.default.target=0.0.0.0:\${local.grpc.sever.port}"
16+
"spring.grpc.server.port=0",
17+
"spring.grpc.client.channel.default.target=0.0.0.0:\${local.grpc.server.port}"
1818
],
1919
)
2020
@DirtiesContext
21-
@Disabled("Need to migrate to Spring Boot 4.1.x")
2221
class GrpcServerApplicationTests {
2322

2423
private val log: Log = LogFactory.getLog(this.javaClass)

0 commit comments

Comments
 (0)