Annotation Interface GrpcClient
Channel or subclasses of AbstractStub/gRPC client services. Also
works for annotated methods that only take a single parameter of these types. Annotated fields/methods will be
automatically populated/invoked by Spring.
Note: Fields/Set-Methods that are annotated with this annotation should NOT be annotated with
Autowired or Inject (conflict).
Note: If you annotate an AbstractStub with this annotation the bean processing will also apply the
StubTransformers in the application context. These can be used, for example, to configure CallOptions
such as CallCredentials. Please note that these transformations aren't applied if you inject a
Channel only.
Note: These annotation allows the specification of custom interceptors. These will be appended to the global
interceptors and applied using ClientInterceptors.interceptForward(Channel, ClientInterceptor...).
Note: The constructor and bean factory injection is experimental.
- See Also:
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionString[]A list ofClientInterceptorbeans that should be used with this client in addition to the globally defined ones.Class<? extends ClientInterceptor>[]A list ofClientInterceptorclasses that should be used with this client in addition to the globally defined ones.booleanWhether the custom interceptors should be mixed with the global interceptors and sorted afterwards.
-
Element Details
-
value
String valueThe name of the grpc client. This name will be used to get theconfig optionsfor this client.Example:
@GrpcClient("myClient")<->grpc.client.myClient.address=static://localhost:9090Note: This value might also be used to check the common / alternative names in server certificate, you can overwrite this value with the
security.authorityOverrideproperty.- Returns:
- The name of the grpc client.
-
-
-
interceptors
Class<? extends ClientInterceptor>[] interceptorsA list ofClientInterceptorclasses that should be used with this client in addition to the globally defined ones. 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 ClientInterceptor classes that should be used.
- Default:
- {}
-
interceptorNames
String[] interceptorNamesA list ofClientInterceptorbeans that should be used with this client in addition to the globally defined ones.Note: Please read the javadocs regarding the ordering of interceptors.
- Returns:
- A list of ClientInterceptor beans that should be used.
- Default:
- {}
-
sortInterceptors
boolean sortInterceptorsWhether 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
-