Spring @RequestBody containing a list of different types (but same interface)

后端 未结 2 917
耶瑟儿~
耶瑟儿~ 2020-12-05 07:44

Let\'s say that I have a domain class :

    public class Zoo{
        private List animals;
        ....

where an Animal is a

2条回答
  •  無奈伤痛
    2020-12-05 08:06

    There is a simpler annotation out now:

    @JsonRootName("dog")
    public class Dog extends Animal {...}
    

    The reference to the annotation can be found on fasterxml.github

提交回复
热议问题