Repository navigation
Add gRPC request scope support (#392) - #436
fernandoripol wants to merge 4 commits into
Conversation
5ab5166 to
df19612
Compare
|
We don't have auto-configuration in this project so the naming is wrong. I also think it would be better to stick those bean definitions in an |
|
Hi @dsyer! Thanks for the valuable feedback. I've updated the PR to remove the old auto-configuration and implemented your suggestion using the @EnableGrpcScope annotation along with the ImportBeanDefinitionRegistrar. Ready for another review! |
5fed8f4 to
bc4ad85
Compare
|
That's good, thanks. We'd still like an annotation for bean definitions (it would have to go in a different package since the name will clash). Have a look at |
|
Hi @dsyer, I've updated the implementation to isolate the bean definition logic into the EnableGrpcRequestScope annotation (along with the registrar) and added the requested integration tests modeled after Spring Web's request scope tests. Ready for another review when you have a moment. |
|
I'm sorry I don't understand. Why do we have 2 |
Signed-off-by: Your Name <you@example.com> Signed-off-by: Fernando Rodrigues Ripol <fernandorodriguesripol@gmail.com>
…onRegistrar Signed-off-by: Fernando Ripol <fernandorodriguesripol@gmail.com> Signed-off-by: Fernando Rodrigues Ripol <fernandorodriguesripol@gmail.com>
ee012e8 to
2c2a10c
Compare
Signed-off-by: Fernando Rodrigues Ripol <fernandorodriguesripol@gmail.com>
|
You deleted the test? |
…rget and style Signed-off-by: Fernando Rodrigues Ripol <fernandorodriguesripol@gmail.com>
|
Hi @dsyer, Apologies for the previous mix-up! The test file was accidentally dropped during a commit cleanup. I have restored and updated GrpcRequestScopeTests under org.springframework.grpc.server.annotation using a non-final target bean for CGLIB proxying. The build, checkstyle, and integration tests have all passed locally, and all commits are properly signed off. Ready for your review! |
This PR adds support for a custom gRPC request scope (
@Scope("grpcRequest")) to the Spring gRPC framework, resolving issue #392.Changes:
GrpcRequestScope: Implements the SpringScopeinterface usingThreadLocalto manage request-scoped beans lifecycle.GrpcRequestScopeServerInterceptor: A gRPCServerInterceptorthat cleans up the thread-local context upon call completion or cancellation.GrpcRequestScopeAutoConfiguration: Auto-configuration class to register both the scope and its server interceptor automatically.