我想知道如何在GET请求中访问深层集合类属性。我的端点映射通过@ModelAttribute注解我的查询字符串:Spring引导控制器enpoint和ModelAttribute深入访问
鉴于:
public class MyEntity
{
Set<Item> items;
Integer status;
// getters setters
}
public class Item
{
String name;
// getters setters
}
我的GET请求:本地主机/实体/状态= 0 &项目[0]。名称=加里
产生波纹管行为?
@RequestMapping(path = "/entities", method = RequestMethod.GET)
public List<MyEntity> findBy(@ModelAttribute MyEntity entity) {
// entity.getItems() is empty and an error is thrown: "Property referenced in indexed property path 'items[0]' is neither an array nor a List nor a Map."
}
我的“项目”应该是一个数组,列表或映射?如果是这样,那么有其他选择继续使用设置??
感谢
是用hibernate映射的实体吗?请包括更多细节您的退货声明在哪里? – ketrox