This project is a simple example of how to use gRPC with Spring Cloud Gateway, with some customizations:
- Disable SSL
- Use protobuf file to generate the gRPC service
- Use protobuf-gradle-plugin to generate the descriptor file
gradle build
or
.\gradlew.bat build
gradle bootRun --parallel
or
.\gradlew.bat bootRun --parallel
curl --location 'localhost:8080/greetings/hello' \
--header 'Content-Type: application/json' \
--data '{
"name" : "John Snow"
}'
- Version 2 of protoc supported. Version 3 is not supported. Watch this
- Don't use required fields in response message.
Use this
message HelloResponse {
optional string greeting = 1;
}
and don't do that
message HelloResponse {
required string greeting = 1;
}