@@ -143,13 +143,13 @@ List<GrpcChannelConfigurer> defaultChannelConfigurers() {
143
143
return Collections .emptyList ();
144
144
}
145
145
146
- // First try the shaded netty channel factory
146
+ // First try the shaded netty channel factory and in process factory
147
147
@ ConditionalOnMissingBean (GrpcChannelFactory .class )
148
148
@ 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" })
150
150
@ Bean
151
151
@ Lazy
152
- GrpcChannelFactory shadedNettyGrpcChannelFactory (
152
+ GrpcChannelFactory inProcessOrShadedNettyGrpcChannelFactory (
153
153
final GrpcChannelsProperties properties ,
154
154
final GlobalClientInterceptorRegistry globalClientInterceptorRegistry ,
155
155
final List <GrpcChannelConfigurer > channelConfigurers ) {
@@ -162,12 +162,13 @@ GrpcChannelFactory shadedNettyGrpcChannelFactory(
162
162
return new InProcessOrAlternativeChannelFactory (properties , inProcessChannelFactory , channelFactory );
163
163
}
164
164
165
- // Then try the normal netty channel factory
165
+ // Then try the normal netty channel factory and in process factory
166
166
@ 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" })
168
169
@ Bean
169
170
@ Lazy
170
- GrpcChannelFactory nettyGrpcChannelFactory (
171
+ GrpcChannelFactory inProcessOrNettyGrpcChannelFactory (
171
172
final GrpcChannelsProperties properties ,
172
173
final GlobalClientInterceptorRegistry globalClientInterceptorRegistry ,
173
174
final List <GrpcChannelConfigurer > channelConfigurers ) {
@@ -180,8 +181,38 @@ GrpcChannelFactory nettyGrpcChannelFactory(
180
181
return new InProcessOrAlternativeChannelFactory (properties , inProcessChannelFactory , channelFactory );
181
182
}
182
183
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
+
183
213
// Finally try the in process channel factory
184
214
@ ConditionalOnMissingBean (GrpcChannelFactory .class )
215
+ @ ConditionalOnClass (name = {"io.grpc.inprocess.InProcessChannelBuilder" })
185
216
@ Bean
186
217
@ Lazy
187
218
GrpcChannelFactory inProcessGrpcChannelFactory (
0 commit comments