Failed to instantiate [java.util.List]: Specified class is an interface

原代码没加@RequestParam,一直给我报这个错,传这个List根本不行

@RequestMapping(value = "/searchPhoneInfos2", method = RequestMethod.GET)
public CommonResult searchPhoneInfos2(int page, int limit, String phoneName, List<String> brand, String system){
int offset = (page - 1) * limit;
CommonResult result = phoneServer.searchPhoneInfos2(limit, offset, phoneName, brand, system);
return result;
}

解决办法就是加@RequestParam,原因不知道,能跑就行了。

@RequestMapping(value = "/searchPhoneInfos2", method = RequestMethod.GET)
public CommonResult searchPhoneInfos2(int page, int limit, String phoneName,@RequestParam(value = "brand", required = false) List<String> brand, String system){
int offset = (page - 1) * limit;
CommonResult result = phoneServer.searchPhoneInfos2(limit, offset, phoneName, brand, system);
return result;
}

本文作者:xiaoovo

本文链接:https://www.cnblogs.com/xiaoovo/p/17460369.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   xiaoovo  阅读(127)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起
🔑