Springboot: Servlet.service() for servlet [dispatcherServlet] in context with path []的可能解法

分手后的思念是犯贱 2023-02-17 14:24 122阅读 0赞
说明:这个可能只是个人犯蠢的错误,不具有代表性
背景:Springboot使用Mybatis,接收post在Mapper层调用数据库的时候报的错
部分错误日志
  1. Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'studentInfo' in 'class com.manager.pojo.StudentInfo'] with root cause
  2. org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'studentInfo' in 'class com.manager.pojo.StudentInfo'
  3. at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:373) ~[mybatis-3.5.4.jar:3.5.4]
  4. at org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:163) ~[mybatis-3.5.4.jar:3.5.4]
  5. at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:162) ~[mybatis-3.5.4.jar:3.5.4]
  6. at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:49) ~[mybatis-3.5.4.jar:3.5.4]
  • 重点:There is no getter for property named 'studentInfo' in 'class
    • studentInfo是那个类名,于是发现了一个非常蠢的错误:Mybatis中参数的调用机制:如果只有一个参数,记为param,则${name}就等价于调用param.getName()
    • 于是修改XML即可消除错误。

发表评论

表情:
评论列表 (有 0 条评论,122人围观)

还没有评论,来说两句吧...

相关阅读