@Target(value={FIELD,METHOD}) @Retention(value=RUNTIME) @Documented @Inherited public @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/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
StubTransformer
s 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...)
.
Modifier and Type | Required Element and Description |
---|---|
String |
value
The name of the grpc client.
|
Modifier and Type | Optional Element and Description |
---|---|
String[] |
interceptorNames
A list of
ClientInterceptor beans that should be used with this client in addition to the globally
defined ones. |
Class<? extends ClientInterceptor>[] |
interceptors
A list of
ClientInterceptor classes that should be used with this client in addition to the globally
defined ones. |
boolean |
sortInterceptors
Whether the custom interceptors should be mixed with the global interceptors and sorted afterwards.
|
public abstract String value
config options
for
this client.
Example: @GrpcClient("myClient")
<->
grpc.client.myClient.address=static://localhost:9090
Note: This value might also be used to check the common / alternative names in server certificate, you can
overwrite this value with the security.authorityOverride
property.
public abstract Class<? extends ClientInterceptor>[] interceptors
ClientInterceptor
classes 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.
public abstract String[] interceptorNames
ClientInterceptor
beans that should be used with this client in addition to the globally
defined ones.
Note: Please read the javadocs regarding the ordering of interceptors.
public abstract boolean sortInterceptors