grpc-ecosystem / grpc-ecosystem/grpc-spring

GrpcClientBean doesn't work without a dependency from the @Configuration class

Open
#633 5 comments 0 reactions 0 assignees View on GitHub
bug feedback required
Dominant language
Java
Stars
3.7k
Forks
858
PR merge metrics
No merged PRs in 30d

Description

I don't know if this is a bug / shortcoming, or it just needs a documentation improvement. :)

We recently tried to convert to using `@GrpcClientBean` on a `@Configuration` class and were surprised that the bean was not created.

We realized, akin to https://github.com/yidongnan/grpc-spring-boot-starter/issues/601 that the post-processor only processes the `@Configuration` if that `@Configuration` itself requires the stub. So, the documentation's example that returns a Service `@Bean` works, and 601 was resolved by injecting and returning the stub.

We expected `@GrpcClientBean` would "just work" and create a bean, which would be much nicer. It seems a bit silly to inject and return the same stub to work around this. We actually found it was cleaner to simply use `@GrpcClient` in the `@Configuration` and return the a `@Bean`.

Thanks!

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported case: use @GrpcClientBean on a @Configuration class without injecting the stub, then compare it with the documented Service @Bean example and issue 601. Done means establishing whether this behavior is intended and, if not, defining the expected bean creation behavior or the documentation needed to explain the workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, java, spring-boot
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.