mybatis配置

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-11-13 17:04  海尚书  阅读(86)  评论(0编辑  收藏  举报