Springboot的报错集合(2)
1、mapper.xml的报错
报错:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atguigu.eduservice.mapper.TeacherMapper.countById] with root cause
原因:
由于配置文件忘记说明mapper的配置文件在哪里,导致报错
解决方法:
1. MyBatis的话,配置文件加上mybatis.mapper-locations=classpath:mapper/*.xml
2. MyBatis-plus的话,配置文件加上mybatis-plus.mapper-locations=classpath:mapper/*.xml
2、缺少所需的请求正文
报错:
Required request body is missing: public com.example.process.Result.R com.example.process.controller.UserController.login(java.util.Map<java.lang.String, java.lang.String>,javax.servlet.http.HttpServletRequest)
原因:
Swagger2注解设置出错
Required request body is missing 缺少所需的请求正文
@ApiOperation("用户登录")
@PostMapping("/login")
@ApiImplicitParams(