@@ -143,13 +143,13 @@ List<GrpcChannelConfigurer> defaultChannelConfigurers() {
143143 return Collections .emptyList ();
144144 }
145145
146- // First try the shaded netty channel factory
146+ // First try the shaded netty channel factory and in process factory
147147 @ ConditionalOnMissingBean (GrpcChannelFactory .class )
148148 @ ConditionalOnClass (name = {"io.grpc.netty.shaded.io.netty.channel.Channel" ,
149- "io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder" })
149+ "io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder" , "io.grpc.inprocess.InProcessChannelBuilder" })
150150 @ Bean
151151 @ Lazy
152- GrpcChannelFactory shadedNettyGrpcChannelFactory (
152+ GrpcChannelFactory inProcessOrShadedNettyGrpcChannelFactory (
153153 final GrpcChannelsProperties properties ,
154154 final GlobalClientInterceptorRegistry globalClientInterceptorRegistry ,
155155 final List <GrpcChannelConfigurer > channelConfigurers ) {
@@ -162,12 +162,13 @@ GrpcChannelFactory shadedNettyGrpcChannelFactory(
162162 return new InProcessOrAlternativeChannelFactory (properties , inProcessChannelFactory , channelFactory );
163163 }
164164
165- // Then try the normal netty channel factory
165+ // Then try the normal netty channel factory and in process factory
166166 @ ConditionalOnMissingBean (GrpcChannelFactory .class )
167- @ ConditionalOnClass (name = {"io.netty.channel.Channel" , "io.grpc.netty.NettyChannelBuilder" })
167+ @ ConditionalOnClass (name = {"io.netty.channel.Channel" , "io.grpc.netty.NettyChannelBuilder" ,
168+ "io.grpc.inprocess.InProcessChannelBuilder" })
168169 @ Bean
169170 @ Lazy
170- GrpcChannelFactory nettyGrpcChannelFactory (
171+ GrpcChannelFactory inProcessOrNettyGrpcChannelFactory (
171172 final GrpcChannelsProperties properties ,
172173 final GlobalClientInterceptorRegistry globalClientInterceptorRegistry ,
173174 final List <GrpcChannelConfigurer > channelConfigurers ) {
@@ -180,8 +181,38 @@ GrpcChannelFactory nettyGrpcChannelFactory(
180181 return new InProcessOrAlternativeChannelFactory (properties , inProcessChannelFactory , channelFactory );
181182 }
182183
184+ // Then try the shaded netty channel factory
185+ @ ConditionalOnMissingBean (GrpcChannelFactory .class )
186+ @ ConditionalOnClass (name = {"io.grpc.netty.shaded.io.netty.channel.Channel" ,
187+ "io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder" })
188+ @ Bean
189+ @ Lazy
190+ GrpcChannelFactory shadedNettyGrpcChannelFactory (
191+ final GrpcChannelsProperties properties ,
192+ final GlobalClientInterceptorRegistry globalClientInterceptorRegistry ,
193+ final List <GrpcChannelConfigurer > channelConfigurers ) {
194+
195+ log .info ("Detected grpc-netty-shaded: Creating ShadedNettyChannelFactory" );
196+ return new ShadedNettyChannelFactory (properties , globalClientInterceptorRegistry , channelConfigurers );
197+ }
198+
199+ // Then try the normal netty channel factory
200+ @ ConditionalOnMissingBean (GrpcChannelFactory .class )
201+ @ ConditionalOnClass (name = {"io.netty.channel.Channel" , "io.grpc.netty.NettyChannelBuilder" })
202+ @ Bean
203+ @ Lazy
204+ GrpcChannelFactory nettyGrpcChannelFactory (
205+ final GrpcChannelsProperties properties ,
206+ final GlobalClientInterceptorRegistry globalClientInterceptorRegistry ,
207+ final List <GrpcChannelConfigurer > channelConfigurers ) {
208+
209+ log .info ("Detected grpc-netty: Creating NettyChannelFactory" );
210+ return new NettyChannelFactory (properties , globalClientInterceptorRegistry , channelConfigurers );
211+ }
212+
183213 // Finally try the in process channel factory
184214 @ ConditionalOnMissingBean (GrpcChannelFactory .class )
215+ @ ConditionalOnClass (name = {"io.grpc.inprocess.InProcessChannelBuilder" })
185216 @ Bean
186217 @ Lazy
187218 GrpcChannelFactory inProcessGrpcChannelFactory (
0 commit comments