Class InProcessTestAutoConfiguration.TestInProcessGrpcChannelFactory

java.lang.Object
org.springframework.grpc.client.DefaultGrpcChannelFactory<io.grpc.inprocess.InProcessChannelBuilder>
org.springframework.grpc.client.InProcessGrpcChannelFactory
org.springframework.boot.grpc.test.autoconfigure.InProcessTestAutoConfiguration.TestInProcessGrpcChannelFactory
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, GrpcChannelFactory
Enclosing class:
InProcessTestAutoConfiguration

public static class InProcessTestAutoConfiguration.TestInProcessGrpcChannelFactory extends InProcessGrpcChannelFactory
Specialization of InProcessGrpcChannelFactory that allows the channel factory to support all targets, not just those that start with 'in-process:'.
Since:
1.0.0
Author:
Chris Bono, Dave Syer, Andrey Litvitski
  • Method Details

    • supports

      public boolean supports(String target)
      Whether this factory supports the given target string.

      The target can be either a valid nameresolver-compliant URI or an authority string as described in Grpc.newChannelBuilder(String, ChannelCredentials), or the name of a user-configured channel (e.g. 'my-channel').

      Specified by:
      supports in interface GrpcChannelFactory
      Overrides:
      supports in class InProcessGrpcChannelFactory
      Parameters:
      target - the target string as described in method javadocs
      Returns:
      true so that the test factory can handle all targets not just those prefixed with 'in-process:'
    • newChannelBuilder

      protected io.grpc.inprocess.InProcessChannelBuilder newChannelBuilder(String target, io.grpc.ChannelCredentials creds)
      Creates a new ManagedChannelBuilder instance for the given target and credentials. The target is a valid nameresolver-compliant URI or an authority string as described in Grpc.newChannelBuilder(String, ChannelCredentials).

      Overrides the parent behavior so that the channel factory can handle all targets, not just those that prefixed with 'in-process:'.

      Overrides:
      newChannelBuilder in class InProcessGrpcChannelFactory
      Parameters:
      target - the target of the channel
      creds - the credentials for the channel which are ignored in this case
      Returns:
      a new inprocess channel builder instance