Http Interface
https://docs.spring.io/spring-framework/reference/web/webflux-http-interface-client.html
快速开始
public interface RepositoryService {
@GetExchange("/todos/{id}")
ToDo getTodo(@PathVariable("id") Integer id);
}RestClient
RestClient restClient = RestClient.builder().baseUrl("https://jsonplaceholder.typicode.com").build();
RestClientAdapter adapter = RestClientAdapter.create(restClient);
HttpServiceProxyFactory factory = HttpServiceProxyFactory.builderFor(adapter).build();
RepositoryService service = factory.createClient(RepositoryService.class);
Todo todo = service.getTodo(1);WebClient
RestTemplate
返回值
方法返回值
描述
方法返回值
描述
错误处理
RestClient
RestTemplate
WebClient
最后更新于