数据库
首页 > 数据库> > 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>

 

标签:sqlSessionFactory,sqlSessionTemplate,spring,required,boot,mybatis,java,store
来源: https://www.cnblogs.com/Zhangzhiq/p/16321096.html