Spring / Spring gRPC Interview Questions
How does Spring's dependency injection interact with generated gRPC service classes?
Generated *ImplBase classes coming out of protoc are plain Java classes with no knowledge of Spring - they are not beans on their own. The integration point is your own class, which extends the generated base class and is annotated with @GrpcService.
Because that subclass is a normal Spring bean, it can use constructor injection to pull in repositories, other services, or configuration exactly as any @Service or @RestController would - the generated base class contributes only the gRPC method signatures and dispatch machinery, while your subclass supplies both the business logic and the standard Spring wiring.
More Related questions...