报的错误如下:
Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "{"success":true,"error_code":"00000","error_message":"成功","data":{"list":[]}}"
断点在controller中跟踪也没问题,
尝试了几次,发现时在controller中只是添加了@Controller,
未添加@RestController的注解
将@Controller换成@RestController,解决此问题

本文详细解析了在Java中从String类型转换到int类型时遇到的NumberFormatException异常,并提供了解决方案。通过添加@RestController注解,成功解决了Controller层的类型转换问题。

被折叠的 条评论
为什么被折叠?



