Java 如何借助WebClient从服务器获取JSON响应?
例如,服务器在JSON表示中返回以下错误:Java 如何借助WebClient从服务器获取JSON响应?,java,json,rest,kotlin,spring-webclient,Java,Json,Rest,Kotlin,Spring Webclient,例如,服务器在JSON表示中返回以下错误: { "errorMessage": "Table already exists: ProductFgh (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ResourceInUseException; Request ID: 6S14VS0E6ESUMG55DL937IC42JVV4KQNSO5AEMVJF66Q9ASUAAJG)",
{
"errorMessage": "Table already exists: ProductFgh (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ResourceInUseException; Request ID: 6S14VS0E6ESUMG55DL937IC42JVV4KQNSO5AEMVJF66Q9ASUAAJG)",
"timeStamp": "2020-Jan-22 11:53:58",
"errorCode": 500,
"projectName": "DynamoDB",
"servicePath": "http://localhost:8090/DynamoDb/createTable",
"controllerName": "class com.example.DynamoDB.DynamoDBController",
"serviceName": "createExampleTable"
}
我的web客户端请求配置如下:
suspend fun getResponseFromServer(): ResponseEntity<*> {
return webClient
.get()
.uri { ... }
.awaitExchange()
.awaitEntity()
}
suspend fun getResponseFromServer():ResponseEntity{
返回网络客户端
.get()
.uri{…}
.交换
.1.实体()
}
如何设置web客户端以使其接收服务器的JSON响应?
我检查了以前的解决方案,但它们似乎已经过时,因为它们都不起作用
请提示我