The error means it needs a JSONProvider or a JSON parser in its code
Option 1: Create a JSON parser
WebClient client = WebClient.create(ENDPOINT_URL);
Response r = client.accept("application/json").get();
MappingJsonFactory factory = new MappingJsonFactory();
JsonParser parser = factory.createJsonParser((InputStream)r.getEntity());
YourModelClass model= parser.readValueAs(YourModelClass.class);
Option 2: Register a JSON provider
List<Object> providers = new ArrayList<>();
providers.add(new JacsksonJsonProvider()); // or you can register your own provider
WebClient client = WebClient.create(ENDPOINT_URL,providers);
Option 1: Create a JSON parser
WebClient client = WebClient.create(ENDPOINT_URL);
Response r = client.accept("application/json").get();
MappingJsonFactory factory = new MappingJsonFactory();
JsonParser parser = factory.createJsonParser((InputStream)r.getEntity());
YourModelClass model= parser.readValueAs(YourModelClass.class);
Option 2: Register a JSON provider
List<Object> providers = new ArrayList<>();
providers.add(new JacsksonJsonProvider()); // or you can register your own provider
WebClient client = WebClient.create(ENDPOINT_URL,providers);
No comments:
Post a Comment