grpc-ecosystem / grpc-ecosystem/grpc-spring

@GrpcAdvice for specific classes only

Open
#804 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
3.7k
Forks
858
PR merge metrics
No merged PRs in 30d

Description

**The context**
We want to have one `@GrpcAdvice` for one grpc endpoint.

**The question**
Is it possible to have one `@GrpcAdvice` for one class that extends a grpc service `public class GrpcBonusController extends BonusServiceGrpc.BonusServiceImplBase {}`

Which versions do you use?
* Spring (boot): 2.5.6
* grpc-java: @latest
* grpc-spring-boot-starter: @latest
* java: version + architecture (64bit?) JDK 17, 64 Bit OS
* Other relevant libraries... none

**Additional information**
In **spring-boot-starter-web** we can do
```
@ControllerAdvice(annotations = PragmaticRestController.class)
public class PragmaticControllerAdvice {}

@PragmaticRestController
public class PragmaticController {}
```
and then this `@ControllerAdvice` will only listen for the `@RestController` that is annotated with this annotation.

Can we do the same here?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.