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 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步