美文网首页
Property 'mapperLocations' was n

Property 'mapperLocations' was n

作者: Buckler | 来源:发表于2021-08-24 11:57 被阅读0次

    Springboot启动控制台报Property 'mapperLocations' was not specified.或运行时报org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误时,给予一下解决方案:

    首先在pom文件里:

    <resources>
                <resource>
                    <directory>src/main/java</directory>
                    <includes>
                        <include>**/*.xml</include>
                    </includes>
                    <filtering>true</filtering>
                </resource>
                <resource>
                    <directory>src/main/resources</directory>
                    <includes>
                        <include>**.*</include>
                    </includes>
                </resource>
            </resources>
    

    其次在application文件里:

    mybatis:
      mapper-locations: classpath:xx/xx/xx/xx/mapper/*.xml
    #  mapper-locations: classpath:xx/xx/xx/xx/mapper/*/*.xml (这里适用于分包情况下又有子包使用对应路径方式)
      type-aliases-package: xx.xx.xx.xx.pojo
      configuration:
        log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    

    至此 不出意外是可以解决问题的!

    相关文章

      网友评论

          本文标题:Property 'mapperLocations' was n

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