Recent Posts
Archives

Posts Tagged ‘SchemaFirst’

PostHeaderIcon [SpringIO2026] Bootiful gRPC

Lecturer

Dr. Dave Syer is a founder of Spring Boot, Spring Cloud and Spring Batch, and the lead of the Spring gRPC project. He has long contributed to Spring Security OAuth, Spring Integration and many other portfolio projects. Josh Long is the Spring Developer Advocate at Broadcom (VMware Tanzu), a prolific speaker, author and live-coder known for demonstrating the full breadth of the Spring ecosystem. Together they present the new first-class Spring integration for gRPC.

Abstract

gRPC offers schema-driven, polyglot, high-performance remote procedure calls. After community implementations slowed, Google encouraged the Spring team to create an official project. Spring gRPC, now at version 1.x and moving its Boot auto-configuration into Spring Boot itself, supplies starters, code-generation plugins, Netty and servlet transports, observability, health checks and seamless OAuth 2 resource-server and client support. This article walks through the live demonstration given by Dave Syer and Josh Long, highlighting the developer experience from protocol-buffer definition to a secured, observable service and client pair.

Why gRPC and the Spring Integration

Remote procedure call has a chequered history, yet gRPC addresses many historical weaknesses. An Interface Definition Language (Protocol Buffers) forces an explicit contract; the same .proto file generates idiomatic stubs in dozens of languages, satisfying polyglot organisations; the binary encoding and a purpose-built Netty server deliver competitive throughput. Existing community Spring integrations had lost momentum, prompting Google to ask the Spring team to take ownership. The resulting Spring gRPC project began as an experimental zero-point release train aligned with Spring Boot 3 and reached 1.0 with Spring Boot 4, gaining the usual long-term support commitments. Auto-configuration is scheduled to move into Spring Boot proper in the 4.1 timeframe, further reducing boilerplate.

From Protocol Buffer to Running Service

A new project is created on start.spring.io by selecting the gRPC server starter (and optionally security and observability). The generated build already contains the Protocol Buffer Maven or Gradle plugin and the necessary dependency management. A simple greetings.proto declares a service with a unary RPC:

syntax = "proto3";
option java_package = "com.example.grpc";
service Greetings {
  rpc Hello (HelloRequest) returns (HelloResponse);
}
message HelloRequest { string name = 1; }
message HelloResponse { string message = 1; }

After code generation the developer extends the generated base class, annotates it as a Spring @Service (or lets component scanning discover it) and implements the method. The Netty-based gRPC server starts automatically on port 9090; if a servlet container is also present the same service can be exposed through the Google-supplied servlet bridge, sharing the HTTP port with ordinary Spring MVC endpoints.

A client project follows the same path. The generated stub is injected as a Spring bean; an HTTP controller can call it exactly as it would call any other collaborator. Because the contract is shared, the two sides remain type-safe even when they live in separate processes.

Observability, Health and Security

Selecting the OpenTelemetry starter on the Initializr causes metrics and traces to be exported automatically; Grafana dashboards immediately show gRPC-specific meters. The standard gRPC health-checking protocol is wired to Spring Boot Actuator’s health indicators, so a Kubernetes gRPC probe reports the same status that an HTTP actuator endpoint would.

Security integration re-uses Spring Security’s OAuth 2 resource-server and client support. On the server side a JWT or opaque-token resource-server configuration protects every RPC. On the client side an interceptor extracts the current OAuth2AuthenticationToken, obtains an access token via the OAuth2AuthorizedClientManager, and attaches it to the outgoing gRPC metadata. The demonstration completes the round-trip: an unauthenticated browser request is redirected to the authorization server, the resulting token is presented to the gRPC service, and the service replies with a greeting that includes the authenticated principal’s name.

The same patterns work with reactive gRPC stubs and with Kotlin, giving teams a uniform programming model across transport and language choices.

Conclusion and Roadmap

Spring gRPC removes the historical friction of adopting gRPC inside a Spring application: starters, automatic code generation, sensible server and client defaults, first-class observability and security. Future work includes deeper controller-style programming models for developers who prefer POJO annotations over generated stubs, and the final migration of auto-configuration into Spring Boot itself. The project already demonstrates that a binary, schema-first RPC technology can feel as natural in the Spring ecosystem as REST or messaging.

Links: