/grpc

Hi, Spring fans! In this installment we look at how to use a GRPC Spring Boot starter to build a native application

Primary LanguageJavaApache License 2.0Apache-2.0

Spring Boot gRPC Sample

The original project off of which this was based has since relocated.

This project is a copy one of the samples from the gRPC Spring Boot Starter. Build and run any way you like to run Spring Boot. E.g:

$ ./mvnw spring-boot:run
...

The server starts by default on port 9090. Test with gRPCurl:

$ grpcurl -d '{"name":"Hi"}' -plaintext localhost:9090 Simple.SayHello
{
  "message": "Hello ==\u003e Hi"
}

Native Image

The services compile to a GraalVM native image, too.

$ ./mvnw -Pnative native:compile
$ ./target/server

The patches needed to make it work in native were a reflection hint (upstream change: oracle/graalvm-reachability-metadata#148) and some autoconfig metadata (upstream change: https://github.com/yidongnan/grpc-spring-boot-starter/pull/775).