解决:java.lang.IllegalStateException: Property ‘configuration‘ and ‘configLocation‘ can not specified

简介: 解决:java.lang.IllegalStateException: Property ‘configuration‘ and ‘configLocation‘ can not specified

本例环境: springboot + IntelliJ IDEA

71e4a54228bba5027af52a4cc4024d4.png

报错信息:

解决:

  在springboot的application.yml不能同时使用以下两个配置,换句话说,两者配置方式只能取其一.

   mybatis:
        config-location: classpath:mybatis/mybatis-config.xml
        configuration:
            map-underscore-to-camel-case: true

正确方式一:

   mybatis:
        # 指定全局配置文件位置
        config-location: classpath:mybatis/mybatis-config.xml
        # 指定sql映射文件位置
       mapper-locations: classpath:mybatis/mapper/*.xml

正确方式二:

   # 指定sql映射文件位置
   mybatis:
       mapper-locations: classpath:mybatis/mapper/*.xml
       configuration:
           map-underscore-to-camel-case: true

以上,TKS.

目录
相关文章
|
7月前
Exception in thread “main“ java.lang.NoClassDefFoundError: freemarker/template/Configuration
Exception in thread “main“ java.lang.NoClassDefFoundError: freemarker/template/Configuration
199 0
Unable to interpret the implicit parameter configuration with dataType: , dataTypeClass: class java.
Unable to interpret the implicit parameter configuration with dataType: , dataTypeClass: class java.
580 0
|
5月前
|
XML Java 数据格式
|
6月前
|
NoSQL 测试技术 Scala
java.lang.RuntimeException: Can‘t start redis server. Check logs for details.
java.lang.RuntimeException: Can‘t start redis server. Check logs for details.
108 1
|
7月前
|
Java 开发工具 计算机视觉
Caused by: java.lang.UnsatisfiedLinkError: Can‘t load AMD 64-bit .dll on a IA 32-bit platform【已解决】
Caused by: java.lang.UnsatisfiedLinkError: Can‘t load AMD 64-bit .dll on a IA 32-bit platform【已解决】
66 0
|
7月前
|
Java
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
168 1
|
7月前
|
Oracle 安全 Java
[Java] `JDK17` 模式变量 `Pattern variable` Variable ‘request‘ can be replaced with pattern variable
[Java] `JDK17` 模式变量 `Pattern variable` Variable ‘request‘ can be replaced with pattern variable
107 0
|
7月前
|
JSON Java 数据格式
【Java报错】记录一次 sun.misc.Unsafe.park(Native Method) Conflicting setter definitions for property 导致的内存泄露
【Java报错】记录一次 sun.misc.Unsafe.park(Native Method) Conflicting setter definitions for property 导致的内存泄露
369 0
|
7月前
|
XML Java 数据库连接
Type mismatch Can‘t assign java.math.BigDecimal to java.lang.Double
Type mismatch Can‘t assign java.math.BigDecimal to java.lang.Double
100 0
|
Java
【Java异常】com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: can not use this method fo
【Java异常】com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: can not use this method fo
639 0