HTTP Interface
/ RestClient
/ HttpComponents 5
SOAP and REST clients.
<dependency>
<groupId>net.optionfactory.spring</groupId>
<artifactId>upstream</artifactId>
</dependency>@Upstream("my-service")
@Upstream.Logging
public interface MyServiceClient {
@GetExchange("/api/data")
Map<String, String> fetchData(@RequestParam("id") String id);
}@Bean
public MyServiceClient myServiceClient(JsonMapper mapper, ConfigurableApplicationContext ac) {
return UpstreamBuilder.create(MyServiceClient.class)
.requestFactoryHttpComponents(c -> {
c.tlsSocketStrategy(HcSocketStrategies.system());
})
.json(mapper)
.expressions(ac)
.publisher(ac)
.baseUri("https://api.example.com")
.build();
}