springboot 2.0 mybatis mapper-locations扫描多个路径
mapper-locations扫描多个路径,中间以,分开,
如果mapper.xml在源码包下,配置成classpath*开头比较好使
1
2
3
4
5
6
7
8
9
10
|
mybatis:
mapper-locations: classpath*:mapper/*.xml,classpath*:com/urthink/upfs/**/*Mapper.xml
type-aliases-package: com.urthink.upfs.springbootmybatis.entity
#IDENTITY: MYSQL #取回主键的方式
#notEmpty: false # insert 和 update 中,是否判断字符串类型!= ''
configuration:
#进行自动映射时,数据以下划线命名,如数据库返回的 "order_address" 命名字段是否映射为class的 "orderAddress" 字段。默认为 false
map-underscore- to -camel- case : true
# 输出SQL执行语句 (log4j2本身可以输出sql语句)
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #这种带结果集
|
maven 打包源码包下的资源文件,如xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
< build >
< resources >
< resource >
< directory >src/main/resources</ directory >
<!-- <excludes>
<exclude>**/*.properties</exclude>
<exclude>**/*.xml</exclude>
</excludes> -->
< includes >
< include >**/*.properties</ include >
< include >**/*.xml</ include >
< include >**/*.yml</ include >
</ includes >
< filtering >false</ filtering >
</ resource >
< resource >
< directory >src/main/java</ directory >
< includes >
< include >**/*.xml</ include >
</ includes >
< filtering >false</ filtering >
</ resource >
</ resources >
</ build >
|
以上为个人经验,希望能给大家一个参考,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/haveqing/article/details/86624055