Spring引导REST端点返回接口(使用Jackson序列化多态类型)
我有一个工作端点:Spring引导REST端点返回接口(使用Jackson序列化多态类型),spring,spring-boot,spring-mvc,Spring,Spring Boot,Spring Mvc,我有一个工作端点: @GetMapping(value = "/my/path") public Map<String, Collection<MyDataType>> getReport(...) {...} 并更新我的端点: @GetMapping(value = "/my/path"") public Map<String, Collection<? extends MyData>> get
@GetMapping(value = "/my/path")
public Map<String, Collection<MyDataType>> getReport(...) {...}
并更新我的端点:
@GetMapping(value = "/my/path"")
public Map<String, Collection<? extends MyData>> get20062008Report(
@GetMapping(value=“/my/path”)
公共地图我发现了问题。这是由于我使用的类型。Jackson没有成功地使用类型?扩展MyData
。
因此,我将替换:
@GetMapping(value = "/my/path"")
public Map<String, Collection<? extends MyData>> get20062008Report(
@GetMapping(value=“/my/path”)
公共MapI已尝试JsonDeserializer(),我想您可以查看以下内容:。如果我没有弄错你的问题:)我们需要一些更多的信息,以便mapper通过接口反序列化。谢谢你的回复。我按照你给我的链接进行了回复:。但这不是我的问题。当我更改Map的返回类型时,它也会起作用。
@GetMapping(value = "/my/path"")
public Map<String, Collection<? extends MyData>> get20062008Report(
@GetMapping(value = "/my/path"")
public Map<String, Collection<MyData>> get20062008Report(