Class GrpcServerFactoryAutoConfiguration
java.lang.Object
net.devh.boot.grpc.server.autoconfigure.GrpcServerFactoryAutoConfiguration
@Configuration(proxyBeanMethods=false)
@ConditionalOnMissingBean({GrpcServerFactory.class,GrpcServerLifecycle.class})
@AutoConfigureAfter(GrpcServerAutoConfiguration.class)
public class GrpcServerFactoryAutoConfiguration
extends Object
The auto configuration that will create the
GrpcServerFactory
s and GrpcServerLifecycle
s, if the
developer hasn't specified their own variant.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioninProcessGrpcServerFactory
(GrpcServerProperties properties, GrpcServiceDiscoverer serviceDiscoverer, List<GrpcServerConfigurer> serverConfigurers) Creates a GrpcServerFactory using the in-process-server, if a name is specified.inProcessGrpcServerLifecycle
(InProcessGrpcServerFactory factory, GrpcServerProperties properties, ApplicationEventPublisher eventPublisher) The server lifecycle bean for the in-process-server.nettyGrpcServerFactory
(GrpcServerProperties properties, GrpcServiceDiscoverer serviceDiscoverer, List<GrpcServerConfigurer> serverConfigurers) Creates a GrpcServerFactory using the non-shaded netty.nettyGrpcServerLifecycle
(NettyGrpcServerFactory factory, GrpcServerProperties properties, ApplicationEventPublisher eventPublisher) The server lifecycle bean for netty based server.shadedNettyGrpcServerFactory
(GrpcServerProperties properties, GrpcServiceDiscoverer serviceDiscoverer, List<GrpcServerConfigurer> serverConfigurers) Creates a GrpcServerFactory using the shaded netty.shadedNettyGrpcServerLifecycle
(ShadedNettyGrpcServerFactory factory, GrpcServerProperties properties, ApplicationEventPublisher eventPublisher) The server lifecycle bean for a shaded netty based server.
-
Constructor Details
-
GrpcServerFactoryAutoConfiguration
public GrpcServerFactoryAutoConfiguration()
-
-
Method Details
-
shadedNettyGrpcServerFactory
@ConditionalOnClass(name={"io.grpc.netty.shaded.io.netty.channel.Channel","io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder"}) @Conditional(ConditionalOnInterprocessServer.class) @Bean public ShadedNettyGrpcServerFactory shadedNettyGrpcServerFactory(GrpcServerProperties properties, GrpcServiceDiscoverer serviceDiscoverer, List<GrpcServerConfigurer> serverConfigurers) Creates a GrpcServerFactory using the shaded netty. This is the recommended default for gRPC.- Parameters:
properties
- The properties used to configure the server.serviceDiscoverer
- The discoverer used to identify the services that should be served.serverConfigurers
- The server configurers that contain additional configuration for the server.- Returns:
- The shadedNettyGrpcServerFactory bean.
-
shadedNettyGrpcServerLifecycle
@ConditionalOnBean(ShadedNettyGrpcServerFactory.class) @Bean public GrpcServerLifecycle shadedNettyGrpcServerLifecycle(ShadedNettyGrpcServerFactory factory, GrpcServerProperties properties, ApplicationEventPublisher eventPublisher) The server lifecycle bean for a shaded netty based server.- Parameters:
factory
- The factory used to create the lifecycle.properties
- The server properties to use.eventPublisher
- The event publisher to use.- Returns:
- The inter-process server lifecycle bean.
-
nettyGrpcServerFactory
@ConditionalOnMissingBean(ShadedNettyGrpcServerFactory.class) @Conditional(ConditionalOnInterprocessServer.class) @ConditionalOnClass(name={"io.netty.channel.Channel","io.grpc.netty.NettyServerBuilder"}) @Bean public NettyGrpcServerFactory nettyGrpcServerFactory(GrpcServerProperties properties, GrpcServiceDiscoverer serviceDiscoverer, List<GrpcServerConfigurer> serverConfigurers) Creates a GrpcServerFactory using the non-shaded netty. This is the fallback, if the shaded one is not present.- Parameters:
properties
- The properties used to configure the server.serviceDiscoverer
- The discoverer used to identify the services that should be served.serverConfigurers
- The server configurers that contain additional configuration for the server.- Returns:
- The shadedNettyGrpcServerFactory bean.
-
nettyGrpcServerLifecycle
@ConditionalOnBean(NettyGrpcServerFactory.class) @Bean public GrpcServerLifecycle nettyGrpcServerLifecycle(NettyGrpcServerFactory factory, GrpcServerProperties properties, ApplicationEventPublisher eventPublisher) The server lifecycle bean for netty based server.- Parameters:
factory
- The factory used to create the lifecycle.properties
- The server properties to use.eventPublisher
- The event publisher to use.- Returns:
- The inter-process server lifecycle bean.
-
inProcessGrpcServerFactory
@ConditionalOnProperty(prefix="grpc.server", name="in-process-name") @Bean public InProcessGrpcServerFactory inProcessGrpcServerFactory(GrpcServerProperties properties, GrpcServiceDiscoverer serviceDiscoverer, List<GrpcServerConfigurer> serverConfigurers) Creates a GrpcServerFactory using the in-process-server, if a name is specified.- Parameters:
properties
- The properties used to configure the server.serviceDiscoverer
- The discoverer used to identify the services that should be served.- Returns:
- The shadedNettyGrpcServerFactory bean.
-
inProcessGrpcServerLifecycle
@ConditionalOnBean(InProcessGrpcServerFactory.class) @Bean public GrpcServerLifecycle inProcessGrpcServerLifecycle(InProcessGrpcServerFactory factory, GrpcServerProperties properties, ApplicationEventPublisher eventPublisher) The server lifecycle bean for the in-process-server.- Parameters:
factory
- The factory used to create the lifecycle.properties
- The server properties to use.eventPublisher
- The event publisher to use.- Returns:
- The in-process server lifecycle bean.
-