Closed OlgaMaciaszek closed 6 months ago
I'm really sorry for the mess around that deprecation @wind57. In fact, it was being load-balanced with the previous change, however, with the caveat that a component constructor would be to early to build the RestClient
instance with a @LoadBalanced RestClient.Builder
, which is why it's been reworked again.
My point was rather different, I'm sorry for not being verbose enough.
Before this PR, I saw that LoadBalancerRestClientBuilderBeanPostProcessor
that was a @Bean
, was removed to be such and deprecated. Now, the question I had, was how is it possible then to find out who is actually annotated with @LoadBalanced
, if not a BeanPostProcessor exists?
Yes, you did add SmartInitializingSingleton
and a customizer, but doesn't that mean that load-balancing will be applied to every instance of RestClinet.Builder
, be that annotated or not with @LoadBalanced
, simply because its done for everyone. There is no logical check of "if bean is annotated with @LoadBalanced" : do that...
I hope I make more sense now. And don't worry about the issue at all!
The @LoadBalanced
annotation over in:
@LoadBalanced @Autowired(required = false) private List<RestClient.Builder> restClientBuilders = Collections.emptyList();
works as a qualifier; that's also how it's always been done for RestTemplate
, just too early for RestClient
for some of the scenarios, since there we work with builder instances and not actual client instances.
oh my, I'm an idiot, you're right! I completely missed the @Qualifier
in @LoadBalanced
. Thank you for taking the time to explain.
No worries, it's not very straightforward.
Load balanced RestClient with deferring postprocessor.