package demo;
import java.io.IOException;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public class Client {
public static void main(String[] args) throws IOException {
String id="1";
WebClient webClient = WebClient.create("http://127.0.0.1:7199");//访问服务器地址
//据id查询
User user=webClient.get()
.uri("/user/{id}",id)
.accept(MediaType.APPLICATION_JSON)
.retrieve()
.bodyToMono(User.class)
.block();
System.out.println("hello :"+user.getName());
}
}