Using Spring Boot together with gRPC and Protobuf

后端 未结 6 1883
傲寒
傲寒 2021-01-31 02:30

Anyone having any examples or thoughts using gRPC together with Spring Boot?

6条回答
  •  时光取名叫无心
    2021-01-31 03:01

    If it's still relevant for you, I've created gRPC spring-boot-starter here.

    grpc-spring-boot-starter auto-configures and runs the embedded gRPC server with @GRpcService-enabled beans.

    The simplest example :

    @GRpcService(grpcServiceOuterClass = GreeterGrpc.class)
    public static class GreeterService implements GreeterGrpc.Greeter {
    
        @Override 
        public void sayHello(GreeterOuterClass.HelloRequest request, StreamObserver responseObserver) {
          // omitted 
        }
    
    }
    

    There is also an example of how to integrate the starter with Eureka in project's README file.

提交回复
热议问题