问答详情
源自:3-6 dao层开发

单元测试启动就报错了,不知道是哪里错了?帮忙看看错误啊

 Error creating bean with name 'areaDao' defined in file
[E:\javacode\springbootmybatisdemo\target\classes\com\spring\springbootmybatisdemo\dao\AreaDao.class]:

Unsatisfied dependency expressed through bean property 'sqlSessionFactory';

nested exception is org.springframework.beans.factory.BeanCreationException:

Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/spring/springbootmybatisdemo/config/dao/SessionFactoryConfiguration.class]:

Invocation of init method failed; nested exception is org.springframework.core.NestedIOException:

 Failed to parse config resource: class path resource [mybatis-config.xml];

nested exception is org.apache.ibatis.builder.BuilderException:

Error parsing SQL Mapper Configuration. Cause:

org.apache.ibatis.builder.BuilderException:

 The setting userColumnLabel is not known.  

Make sure you spelled it correctly (case sensitive).

提问者:慕粉3604928 2018-06-27 14:49

个回答

  • 慕粉3604928
    2018-06-27 20:03:52

    已经找到原因了,mybatis-config.xml中需要将下面这个配置注释掉,不然就会报错!
    <setting name="userColumnLabel" value="true" />

  • 慕移动0132182
    2018-06-27 16:51:56

    你看下数据库配置是否有误,可以断点查看

    createSqlSessionFactoryBean

    方法体中 读取的mysql和用户名密码的配置内容