spring-projects-experimental / spring-cloud-square

Spring Cloud auto-configuration of Retrofit and OkHttp (with Spring Cloud LoadBalancer).
Apache License 2.0
142 stars 34 forks source link

Allow definition of WebClient.Builder in custom configuration referenced in @RetrofitClient or @EnableRetrofitClients #52

Open michael-wirth opened 2 years ago

michael-wirth commented 2 years ago

Not sure if this is a bug or a missing feature. The WebClient.Builder can't be defined in a custom Configuration defined in a child applicationcontext for each RetrofitClient.

Describe the solution you'd like

Describe alternatives you've considered none

OlgaMaciaszek commented 1 year ago

Hello @michael-wirth, this is a model we've had for any similar child-context- based implementations, such as SC OpenFeign and SC LoadBalancer and we've never had any requests for this, which, by itself, is not a reason to not to add this feature. However, there's a feature parity issue between the load-balanced and non-load-balanced version here. A @LoadBalanced WebClient.Builder could not be declared here, cause it would not be properly processed by [LoadBalancerWebClientBuilderPostProcessor](https://github.com/spring-cloud/spring-cloud-commons/blob/main/spring-cloud-commons/src/main/java/org/springframework/cloud/client/loadbalancer/reactive/LoadBalancerWebClientBuilderBeanPostProcessor.java) and clients would not resolved URLs from serviceIds. I don't think should add a feature that would only work on non-loadbalanced version.