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>

 

posted on 2022-05-28 16:54  zzq156  阅读(4653)  评论(0编辑  收藏  举报