這個(gè)問題一直沒解決,有沒有人幫忙看下
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/imooc/demo/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 mapUnderScoreToCamelCass is not known.? Make sure you spelled it correctly (case sensitive).
2020-04-13
錯(cuò)誤提示:mapUnderScoreToCamelCass不能識(shí)別,可能的原因是Mybatis的SpringBoot的支持版本不一致,建議少使用XML配置文件。因?yàn)镾pringBoot2.2以上直接在properties中進(jìn)行Mybatis的配置了,如下所示:
<dependency>
??????????? <groupId>org.mybatis.spring.boot</groupId>
??????????? <artifactId>mybatis-spring-boot-starter</artifactId>
??????????? <version>2.1.2</version>
??????? </dependency>
在 application.properties 配置文件中, 增加
SpringBoot 和 MyBatis 整合的相關(guān)配置:
#加載 MyBatis 配置文件
mybatis.mapper-locations=classpath:mapper/*.xml
mybatis.type-aliases-package=org.edsia.entity //實(shí)體類的包路徑
#MySQL數(shù)據(jù)源配置
spring.datasource.url=jdbc:mysql://localhost:3306/testdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=admin
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver