0
我控制器無法映射谷歌番石榴Multimap
從前端來。我從我的JavaScript本所發送對象:Spring MVC的映射番石榴Multimap之
{1:[true,false], 2:[false,true], ...}.
如果我使用一個標準
java.util.Map<Long, List<Boolean>>
一切工作正常。但不與番石榴Multimap
。我是否必須配置Spring來使用一些自定義轉換器,或者有什麼問題?
控制器是:
@RequestMapping(path = "/myurl", method = RequestMethod.POST, produces = CotrollerKonstanten.JSON_UTF8)
public long myMethod(@RequestBody MappingDto mappingDto) {
//...
}
我的例外是:
org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Can not construct instance of com.google.common.collect.Multimap, problem: abstract types either need to be mapped to concrete types, have custom deserializer, or be instantiated with additional type information at [Source: [email protected]; line: 1, column: 13] (through reference chain: ...myClass); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.google.common.collect.Multimap, problem: abstract types either need to be mapped to concrete types, have custom deserializer, or be instantiated with additional type information
請更具體些:告訴我們你的代碼(控制器,轉換器),你會得到一個異常。 – Xaerxess