mybatis: Property 'configuration' and 'configLocation' can not specified with together

时间:2021-10-07
本文章向大家介绍mybatis: Property 'configuration' and 'configLocation' can not specified with together,主要包括mybatis: Property 'configuration' and 'configLocation' can not specified with together使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'studentService': Unsatisfied dependency expressed through field 'studentMapper'; 
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'studentMapper' defined in file [D:\javaproject\demo\target\classes\com\wang\demo\mapper\StudentMapper.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 [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.IllegalStateException: Property 'configuration' and 'configLocation' can not specified with together
	

很长的一段错误,我们直接看最后,最后的才是最基础的错误原因,之前的都是由他引发的。

Property 'configuration' and 'configLocation' can not specified with together

configuration和configLocation不能同时存在

看来只能把所有的设置写在mybatis-config.xml里了!

我有一壶酒 足以慰风尘 尽倾江海里 赠饮天下人

原文地址:https://www.cnblogs.com/wangstudyblog/p/15375943.html