README: English | Chinese
Features
Auto configuring and run the embedded gRPC server with @GrpcService-enabled beans as part of spring-boot application.
Support Spring Cloud(registe services to consul or eureka and fetch gRPC server information)
Support Spring Sleuth to trace application
Support global and customer gRPC server/client interceptors
gRPC server
To add a dependency using Maven, use the following:
<dependency> <groupId>net.devh</groupId> <artifactId>grpc-server-spring-boot-starter</artifactId> . < version > 1.0.0 RELEASE < / version > < / dependency >
Copy the code
To add a dependency using Gradle:
Dependencies {compile 'net.devh:grpc-server-spring-boot-starter:1.0.0.
Copy the code
Annotate your server interface implementation(s) with @GrpcService
@GrpcService(GreeterGrpc.class)
public class GrpcServerService extends GreeterGrpc.GreeterImplBase {
@Override
public void sayHello(HelloRequest req.StreamObserver<HelloReply> responseObserver) {
HelloReply reply = HelloReply.newBuilder().setMessage("Hello =============> " + req.getName()).build();
responseObserver.onNext(reply);
responseObserver.onCompleted(); }}Copy the code