美文网首页
2020-03-18记框架整合加入mybatis-plus后找不

2020-03-18记框架整合加入mybatis-plus后找不

作者: 夜色001 | 来源:发表于2020-03-18 23:20 被阅读0次

    引入mybatis-plus后,调用dao中的接口,出现Invalid bound statement (not found)异常

    exception type:org.apache.ibatis.binding.BindingException, exception message:Invalid bound statement (not found): 
    pro....ktwelve.modules.sys.dao.SysUserDao.queryByUserName, requestUrl:/sys/login
    org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 
    pro....ktwelve.modules.sys.dao.SysUserDao.queryByUserName
        at com.baomidou.mybatisplus.core.override.PageMapperMethod$SqlCommand.<init>(PageMapperMethod.java:261)
    Resolved [org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 
    pro....ktwelve.modules.sys.dao.SysUserDao.queryByUserName]
    

    解决方法:修改配置文件mybatis改为mybatis-plus

    mybatis-plus:
      type-aliases-package: pro...domain,pro....ktwelve.modules.sys.entity
      mapper-locations: classpath*:/mappers/*.xml,classpath*:/mappers/**/*.xml
      configuration:
        mapUnderscoreToCamelCase: true
        map-underscore-to-camel-case: true
        #强力的SQL打印
        log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    

    另外要注意mapper-locations的写法:classpath后的不可少,*.xml也不能少,否则可能报文件找不到的错误

    Caused by: java.nio.file.AccessDeniedException: F:\git-source\mayun\ktwelve_Server\k12-business\target\classes\mappers\sys
    

    相关文章

      网友评论

          本文标题:2020-03-18记框架整合加入mybatis-plus后找不

          本文链接:https://www.haomeiwen.com/subject/spmhyhtx.html