0221错误解析

6.关于MyBatis和MyBatisPlus配置

两者单个存在

# MyBatis配置
mybatis:
  # 搜索指定包别名
  typeAliasesPackage: com.zzyl.**.domain
  # 配置mapper的扫描,找到所有的mapper.xml映射文件
  mapperLocations: classpath*:mapper/**/*Mapper.xml
  # 加载全局的配置文件
  configLocation: classpath:mybatis/mybatis-config.xml
      
# MyBatisPlus配置
mybatis-plus:
  # 搜索指定包别名
  typeAliasesPackage: com.zzyl.**.domain
  # 配置mapper的扫描,找到所有的mapper.xml映射文件
  mapperLocations: classpath*:mapper/**/*Mapper.xml
  # 全局配置
  global-config:
    db-config:
      id-type: auto   #id生成策略为自增
  configuration:
    map-underscore-to-camel-case: true    #字段与属性,自动转换为驼峰命名

当配置MyBatisPlus时

# MyBatisPlus配置
mybatis-plus:
  # 搜索指定包别名
  typeAliasesPackage: com.zzyl.**.domain
  # 配置mapper的扫描,找到所有的mapper.xml映射文件
  mapperLocations: classpath*:mapper/**/*Mapper.xml
  # 全局配置
  global-config:
    db-config:
      id-type: auto   #id生成策略为自增
  configuration:
    map-underscore-to-camel-case: true    #字段与属性,自动转换为驼峰命名
    # 加载全局的配置文件
  configLocation: classpath:mybatis/mybatis-config.xml

configuration和configLocation不可同时出现,会出现以下错误

Property 'configuration' and 'configLocation' can not specified with together

posted @ 2025-02-21 21:22  留梦&  阅读(26)  评论(0)    收藏  举报