下面展示一下相关的参数配置。
xml 路径
比如
1 | mybatis.mapper-locations=classpath*:mapper/*.xml |
classpath:只会到你的class路径中查找找文件。classpath*:不仅包含class路径,还包括jar文件中(class路径)进行查找。
注意: 用 classpath* :需要遍历所有的 classpath ,所以加载速度是很慢的;因此,在规划的时候,应该尽可能规划好资源文件所在的路径,尽量避免使用 classpath*。
后面
*.xml是mapper文件夹下面的xml后缀的文件*Mapper.xml是后缀是Mapper.xml文件
1 | mybatis.mapper-locations=classpath:mapper/**/*.xml |
上面的 xml 的意思是,mapper 文件夹下面各种子目录的下面的 xml 文件
SQL debug
1 | mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl |
加上这个配置,你的 mybatis 就能输出 SQL 的 debug 信息。