首先给大家看一下完整的异常:
“exception”:“org.springframework.http.converter.HttpMessageNotReadableException”,
“message”: “Could not read document: Can not deserialize instance of java.lang.Integer out of START_OBJECT token\n at [Source: java.io.PushbackInputStream@70ee075c; line: 1, column: 1]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.Integer out of START_OBJECT token\n at [Source: java.io.PushbackInputStream@70ee075c; line: 1, column: 1]”,
我是在测试" getById "方法时出现异常的,传入的参数也是没问题的:
方法是这个:
下面说一下解决方法吧:
修改这两处即可解决!