Shouldn't the ProxyHttpServiceGroup::createProxies method set the proxyFactoryBuilder's exchangeAdapter only if it isn't set already?
As already reported in https://github.com/spring-projects/spring-boot/issues/47855, I'm trying to integrate my existing RestClient and WebClient auto-configuration with what is added to Boot 4.0.0-RC1. However, whatever I configure with the following is ignored:
@Configuration
@ImportHttpServices(group = "bidule", types = {BiduleApi.class})
@ImportHttpServices(group = "machin", types = {MachinApi.class})
public class RestConfiguration {
@Bean
RestClientHttpServiceGroupConfigurer groupConfigurer(RestClient biduleClient,
RestClient machinClient) {
return groups -> {
groups.forEachGroup((group, clientBuilder, factoryBuilder) -> {
if ("bidule".equals(group.name())) {
factoryBuilder.exchangeAdapter(RestClientAdapter.create(biduleClient));
} else if ("machin".equals(group.name())) {
factoryBuilder.exchangeAdapter(RestClientAdapter.create(machinClient));
}
});
};
}
}
Comment From: oscarfanchin
The issue has not been analyzed yet, I think it will take some time, for the auto config of the clients (without security) I use this starter httpexchange-spring-boot-starter, since I understood the new functionality that gives you problems it should replace it
Comment From: ch4mpy
@oscarfanchin, no, httpexchange-spring-boot-starter is not an alternative as:
- As far as I know, it doesn't allow switching the underlying REST client @Bean to use (RestClient or WebClient) with one that isn't auto-configured by httpexchange-spring-boot-starter itself. In the sample above, biduleClient and machinClient are such beans.
- Options for the underlying REST client bean auto-configured by httpexchange-spring-boot-starter are not enough for my needs. I happen to work behind an HTTP proxy, the APIs I call require different authorization mechanisms, and some internal APIs use self-signed SSL certificates, requiring me to tweak the SSL bundles.