zoukankan      html  css  js  c++  java
  • IllegalStateException: Property 'configuration' and 'configLocation' can not specified with together

    SpringBoot + Mybatis 配置遇到的错误

    错误日志

    Caused by: java.lang.IllegalStateException: Property 'configuration' and 'configLocation' can not specified with together
    	at org.springframework.util.Assert.state(Assert.java:76) ~[spring-core-5.3.1.jar:5.3.1]
    	at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:488) ~[mybatis-spring-2.0.6.jar:2.0.6]
    	at org.mybatis.spring.SqlSessionFactoryBean.getObject(SqlSessionFactoryBean.java:633) ~[mybatis-spring-2.0.6.jar:2.0.6]
    

    原因

    • 配置重复导致冲突

    已经

    /**
     * MyBatis 自定义配置
     *
     * @author xiaoming
     * @date 2020-11-29 15:59
     */
    @org.springframework.context.annotation.Configuration
    public class MybatisConfig {
    
        @Bean
        public ConfigurationCustomizer configurationCustomizer() {
            return  new ConfigurationCustomizer() {
                @Override
                public void customize(Configuration configuration) {
                    // 开启驼峰命名, 如: department_name -- 映射 ---> departmentName
                    configuration.setMapUnderscoreToCamelCase(true);
                }
            };
    
        }
    }
    
    # myBatis 配置
    mybatis:
      configuration:
        # 驼峰命名
        map-underscore-to-camel-case: true # 配置冲突了
    
  • 相关阅读:
    go语言判断末尾不同的长字符串的方法
    Go语言高级特性总结——Struct、Map与JSON之间的转化
    MacOS使用常用配置
    关于联盟链的一种激励扩张思路(原创)
    密码学中经典算法及应用
    无线网络
    基础的并查集
    找单词
    找零钱
    最大子矩阵
  • 原文地址:https://www.cnblogs.com/52liming/p/14089127.html
Copyright © 2011-2022 走看看