30 lines
995 B
Java
30 lines
995 B
Java
package nl.sligro.hybrisdemo.api.hybris;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.http.HttpStatusCode;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.web.reactive.function.client.WebClient;
|
|
import org.springframework.web.reactive.function.client.support.WebClientAdapter;
|
|
import org.springframework.web.service.invoker.HttpServiceProxyFactory;
|
|
|
|
@Service
|
|
public class Clients {
|
|
@Bean
|
|
WebClient webClient() {
|
|
return WebClient.builder()
|
|
.baseUrl("https://tst-hybris.sligro-digital.nl/sligrocommercewebservices/v2")
|
|
.build();
|
|
}
|
|
|
|
@Bean
|
|
public HttpServiceProxyFactory httpServiceProxyFactory(WebClient webClient) {
|
|
return HttpServiceProxyFactory.builder(WebClientAdapter.forClient(webClient))
|
|
.build();
|
|
}
|
|
|
|
@Bean
|
|
public ProductApi productApi(HttpServiceProxyFactory factory) {
|
|
return factory.createClient(ProductApi.class);
|
|
}
|
|
}
|