grpc-spring icon indicating copy to clipboard operation
grpc-spring copied to clipboard

@GrpcAdvice for specific classes only

Open Aleksander-Dorkov opened this issue 2 years ago • 1 comments

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?

Aleksander-Dorkov avatar Dec 12 '22 06:12 Aleksander-Dorkov

Can we do the same here?

This is currently not supported, but planned for later.

ST-DDT avatar Dec 12 '22 09:12 ST-DDT