Class GrpcReflectionFactory

java.lang.Object
io.micronaut.grpc.server.reflection.GrpcReflectionFactory

@Factory @Internal @Requires(classes=io.grpc.protobuf.services.ProtoReflectionServiceV1.class) public class GrpcReflectionFactory extends Object
Registers the gRPC server reflection service (grpc.reflection.v1.ServerReflection) so that tools such as grpcurl, Postman or grpcui can discover the services exposed by the server.

Applications enable it through configuration and don't use this class directly.

Reflection is disabled by default because it exposes the full API surface. Enable it with grpc.server.reflection.enabled=true. The io.grpc:grpc-services dependency must be on the classpath.

Since:
5.3.0
  • Field Details

    • REFLECTION_ENABLED

      public static final String REFLECTION_ENABLED
      The configuration property that enables the reflection service.
      See Also:
    • REFLECTION_SERVICE_NAME

      public static final String REFLECTION_SERVICE_NAME
      The name of the reflection service bean.
      See Also:
  • Constructor Details

    • GrpcReflectionFactory

      public GrpcReflectionFactory()
  • Method Details

    • grpcReflectionService

      @Singleton @Named("grpc-reflection") @Requires(property="grpc.server.reflection.enabled", value="true", defaultValue="false") protected io.grpc.BindableService grpcReflectionService()
      Creates the reflection service. It is registered with the gRPC server like any other BindableService bean.
      Returns:
      The reflection service