Tag Archives: 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
	

For a long period of mistakes, let’s look directly at the last. The last is the most basic reason for the mistakes. The previous ones were caused by him.

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

Configuration and configlocation cannot exist at the same time

It seems that you can only write all the settings in mybatis-config.xml!