Annotation Interface GrpcService


@Target({TYPE,METHOD}) @Retention(RUNTIME) @Documented @Service @Bean public @interface GrpcService
Annotation that marks gRPC services that should be registered with a gRPC server. If spring-boot's auto configuration is used, then the server will be created automatically. This annotation should only be added to implementations of BindableService (GrpcService-ImplBase).

Note: These annotation allows the specification of custom interceptors. These will be appended to the global interceptors and applied using ServerInterceptors.interceptForward(BindableService, ServerInterceptor...).

  • Element Details

    • interceptors

      Class<? extends ServerInterceptor>[] interceptors
      A list of ServerInterceptor classes that should be applied to only this service. If a bean of the given type exists, it will be used; otherwise a new instance of that class will be created via no-args constructor.

      Note: Please read the javadocs regarding the ordering of interceptors.

      Returns:
      A list of ServerInterceptor classes that should be used.
      Default:
      {}
    • interceptorNames

      String[] interceptorNames
      A list of ServerInterceptor beans that should be applied to only this service.

      Note: Please read the javadocs regarding the ordering of interceptors.

      Returns:
      A list of ServerInterceptor beans that should be used.
      Default:
      {}
    • sortInterceptors

      boolean sortInterceptors
      Whether the custom interceptors should be mixed with the global interceptors and sorted afterwards. Use this option if you want to add a custom interceptor between global interceptors.
      Returns:
      True, if the custom interceptors should be merged with the global ones and sorted afterwards. False otherwise.
      Default:
      false