spring boot之mybatis配置

配置在application.yml文件中

mybatis-plus:
  # 如果是放在src/main/java目录下 classpath:/com/yourpackage/*/mapper/*Mapper.xml
  mapper-locations: classpath:/com/bonc/flsz/**/mapping/*.xml
  #实体扫描,多个package用逗号或者分号分隔
  typeAliasesPackage: com.bonc.flsz.*.model
  global-config:
    #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
    id-type: 1
    #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
    field-strategy: 2
    #驼峰下划线转换
    db-column-underline: true
  configuration:
    map-underscore-to-camel-case: true
    cache-enabled: true #配置的缓存的全局开关
    lazyLoadingEnabled: true #延时加载的开关
    multipleResultSetsEnabled: true #开启的话,延时加载一个属性时会加载该对象全部属性,否则按需加载属性
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #打印sql语句,调试用

 pom里的配置

在<build>中

<resources>
<resource>
<directory>src/main/resources</directory>
</resource>

<resource>
<directory>src/main/java</directory>
<filtering>false</filtering>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
posted @ 2019-03-26 17:42  無玑小姐  阅读(262)  评论(0编辑  收藏  举报