如下这种:
mapper-locations可以配置多个目录
mapper-locations:
- classpath:mapper/*.xml
- classpath*:mapper/*.xml
本质在于把mapper的位置告诉springboot,类似主启动类中mapperscan的作用。
运行项目,我们会发现target文件目录结构
原本的src/main/java下的文件全部放在com中,而resource内的文件则跟com处于同级目录。classpath就代表这里的classes
classpath和classpath*的区别
- classpath:只会到你的class路径中查找找文件。
- classpath*:不仅包含class路径,还包括jar文件中(class路径)进行查找。
注意: 用classpath:需要遍历所有的classpath,所以加载速度是很慢的;因此,在规划的时候,应该尽可能规划好资源文件所在的路径,尽量避免使用classpath。******
表示可以表示任意多级目录