Class GrpcServiceRegistrationBean


public class GrpcServiceRegistrationBean
extends AbstractServiceRegistrationBean<HttpServiceWithRoutes,​GrpcServiceRegistrationBean,​GrpcExampleRequest,​GrpcExampleHeaders>
A bean with information for registering a gRPC service. It enables Micrometer metric collection of the service automatically.

 > @Bean
 > public GrpcServiceRegistrationBean helloService() {
 >     return new GrpcServiceRegistrationBean()
 >             .setServiceName("helloService")
 >             .setService(GrpcService.builder()
 >                                    .addService(new HelloService())
 >                                    .supportedSerializationFormats(GrpcSerializationFormats.values())
 >                                    .enableUnframedRequests(true)
 >                                    .build())
 >             .setDecorators(LoggingService.newDecorator())
 >             .addExampleRequests(GrpcExampleRequest.of(
 >                    HelloServiceGrpc.SERVICE_NAME, "Hello",
 >                    HelloRequest.newBuilder().setName("Armeria").build()))
 >             .addExampleHeaders(GrpcExampleHeaders.of(HelloServiceGrpc.SERVICE_NAME,
 >                                                      HttpHeaders.of("my-header", "headerVal")));
 > }