public class GrpcClientBeanPostProcessor
extends java.lang.Object
implements org.springframework.beans.factory.config.BeanPostProcessor
BeanPostProcessor searches for fields and methods in beans that are annotated with GrpcClient
and sets them.| Constructor and Description |
|---|
GrpcClientBeanPostProcessor(org.springframework.context.ApplicationContext applicationContext) |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.List<io.grpc.ClientInterceptor> |
interceptorsFromAnnotation(GrpcClient annotation)
Gets or creates the
ClientInterceptors that are referenced in the given annotation. |
java.lang.Object |
postProcessBeforeInitialization(java.lang.Object bean,
java.lang.String beanName) |
protected <T> T |
processInjectionPoint(java.lang.reflect.Member injectionTarget,
java.lang.Class<T> injectionType,
GrpcClient annotation)
Processes the given injection point and computes the appropriate value for the injection.
|
protected <T> T |
valueForMember(java.lang.String name,
java.lang.reflect.Member injectionTarget,
java.lang.Class<T> injectionType,
io.grpc.Channel channel)
Creates the instance to be injected for the given member.
|
public GrpcClientBeanPostProcessor(org.springframework.context.ApplicationContext applicationContext)
public java.lang.Object postProcessBeforeInitialization(java.lang.Object bean,
java.lang.String beanName)
throws org.springframework.beans.BeansException
postProcessBeforeInitialization in interface org.springframework.beans.factory.config.BeanPostProcessororg.springframework.beans.BeansExceptionprotected <T> T processInjectionPoint(java.lang.reflect.Member injectionTarget,
java.lang.Class<T> injectionType,
GrpcClient annotation)
T - The type of the value to be injected.injectionTarget - The target of the injection.injectionType - The class that will be used to compute injection.annotation - The annotation on the target with the metadata for the injection.protected java.util.List<io.grpc.ClientInterceptor> interceptorsFromAnnotation(GrpcClient annotation) throws org.springframework.beans.BeansException
ClientInterceptors that are referenced in the given annotation.
Note: This methods return value does not contain the global client interceptors because they are handled
by the GrpcChannelFactory.
annotation - The annotation to get the interceptors for.org.springframework.beans.BeansException - If the referenced interceptors weren't found or could not be created.protected <T> T valueForMember(java.lang.String name,
java.lang.reflect.Member injectionTarget,
java.lang.Class<T> injectionType,
io.grpc.Channel channel)
throws org.springframework.beans.BeansException
T - The type of the instance to be injected.name - The name that was used to create the channel.injectionTarget - The target member for the injection.injectionType - The class that should injected.channel - The channel that should be used to create the instance.org.springframework.beans.BeansException - If the value of the field could not be created or the type of the field is unsupported.