第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Json 無法反序列化 Spring 中的實例錯誤

Json 無法反序列化 Spring 中的實例錯誤

蝴蝶刀刀 2021-10-28 15:06:56
我正在嘗試發(fā)送一個 json 長列表并從 db 中獲取記錄。我的控制器是:@Api(tags = Endpoint.RESOURCE_customer, description = "customer Resource")@RestController@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE,consumes = MediaType.APPLICATION_JSON_VALUE)@ResponseStatus(HttpStatus.OK)public class CustomerResourceController {    private final customerService customerService;    public CustomerResourceController(customerService customerService) {        this.customerService = customerService;    }    @ApiOperation(            value = "Return customer",            response = customerDto.class, responseContainer="List"    )    @PostMapping(value = Endpoint.RRESOURCE_customer_ID)    public List<customerDto> getCustomersByIds(@RequestBody List<Long> ids) {        return customerService.findcustomerIds(ids);    }}和客戶端類是:@Headers("Content-Type: " + MediaType.APPLICATION_JSON_VALUE)public interface CustomerClient {@RequestLine("POST /customer/customers/search")    List<LocGrpDto> getCustomersByIds(@RequestBody @Validated List<Long> ids);}我使用 JSON 在郵遞員中測試此服務:{ "ids": [1,7,8] }但我收到此錯誤:{    "timestamp": "2018-10-05T13:29:57.645+0000",    "status": 400,    "error": "Bad Request",    "message": "Could not read document: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token\n at [Source: java.io.PushbackInputStream@3cb8b584; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token\n at [Source: java.io.PushbackInputStream@3cb8b584; line: 1, column: 1]",    "path": "/api/v1/customer/customers/search",    "errors": []}問題是什么?您在這里看到任何問題嗎,或者可能是由于我的服務類或 dto 類引起的?
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 365 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號