mybatis mapper-locations作用

application上配置了@MapperScan(扫面mapper类的路径)和pom.xml中放行了mapper.xml后,配置mapper-locations没有意义

查找后得知,如果mapper类和mapper.xml不在同一个路径下时,mapper-locations就有用了,在pom.xml中配置

mybatis.mapper-locations=classpath*:com/example/demo/mapper/*.xml

用mapper-locations指定mapper.xml的路径,实验成功


posted @ 2019-04-23 14:45  一天到晚想名字  阅读(31660)  评论(4编辑  收藏  举报