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里了!

posted @ 2021-10-07 14:58  刚刚好。  阅读(1019)  评论(0编辑  收藏  举报