grpc-starter
grpc-starter copied to clipboard
Out-of-the-box, highly extendable Spring Boot starters for the cutting-edge gRPC ecosystem and modern Java!
gRPC Starter

gRPC is an RPC framework with robust features like high performance, multi-language support, concise service definitions, and streaming. It is an ideal choice for building scalable and efficient microservice systems.
This project provides out-of-the-box, highly extensible Spring Boot starters for gRPC ecosystem. Make the integration of Spring Boot and gRPC feel seamless and native.
Features
Core:
- Dependencies management for gRPC related libraries
- gRPC server autoconfiguration
- gRPC client autoconfiguration
Extensions:
- gRPC HTTP transcoding: A single codebase to support both gRPC and HTTP/JSON.
- Protobuf validation: Protobuf message validation implemented by protovalidate/protoc-gen-validate.
- Metrics: Spring Boot Actuator integration with gRPC service.
- Tracing: Spring Boot Actuator integration with gRPC server and client.
-
Testing: Integration with
SpringBootTest
.
Quick Start
implementation(platform("io.github.danielliu1123:grpc-starter-dependencies:<latest>"))
implementation("io.github.danielliu1123:grpc-boot-starter")
implementation("io.grpc:grpc-testing-proto")
@SpringBootApplication
public class SimpleApp extends SimpleServiceGrpc.SimpleServiceImplBase {
public static void main(String[] args) {
new SpringApplicationBuilder(SimpleApp.class)
.properties("grpc.client.base-packages=io.grpc")
.properties("grpc.client.authority=127.0.0.1:9090")
.run(args);
}
@Override
public void unaryRpc(SimpleRequest request, StreamObserver<SimpleResponse> r) {
var response = SimpleResponse.newBuilder()
.setResponseMessage("Hello " + request.getRequestMessage())
.build();
r.onNext(response);
r.onCompleted();
}
@Bean
ApplicationRunner runner(SimpleServiceGrpc.SimpleServiceBlockingStub stub) {
return args -> {
var response = stub.unaryRpc(SimpleRequest.newBuilder().setRequestMessage("World!").build());
System.out.println(response.getResponseMessage());
};
}
}
Refer to quick-start.
Documentation
Go to Reference Documentation for more information.
Code of Conduct
This project is governed by the Code of Conduct. By participating, you are expected to uphold this code of conduct. Please report unacceptable behavior to [email protected].
Contributing
The issue tracker is the preferred channel for bug reports, feature requests and submitting pull requests.
If you would like to contribute to the project, please refer to Contributing.
License
The MIT License.