本例环境: springboot + IntelliJ IDEA
报错信息:
解决:
在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.
解决:java.lang.IllegalStateException: Property 'configuration' and 'configLocation' can not specified
最新推荐文章于 2024-11-13 00:54:52 发布
本文详细解析了在SpringBoot项目中使用MyBatis时,application.yml配置文件中出现的配置冲突问题。指出在同一文件中同时设置mybatis的config-location和configuration属性会导致错误,并提供了两种正确的配置方式,帮助开发者避免此类问题。
1554

被折叠的 条评论
为什么被折叠?



