C/C++教程

010 问题:Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

本文主要是介绍010 问题:Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

错误提示:

java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMapper' defined in file [D:\java\store\store\target\classes\com\cy\store\mapper\UserMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
Caused by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

翻译:

 

 

 

原因是mybatis-spring-1.3.2中取消了自动注入SqlSessionFactory 和 SqlSessionTemplate,也就是mybatis依赖版本的问题。

解决办法:

自己的解决办法:

  缺少了mybatis-spring-boot-starter

  

 

 maven中

		<dependency>
			<groupId>org.mybatis.spring.boot</groupId>
			<artifactId>mybatis-spring-boot-starter</artifactId>
			<version>1.3.2</version>
		</dependency>

 

这篇关于010 问题:Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!