Springboot 2.0.4 整合Mybatis出现异常Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

在使用Springboot 2.0.4 整合Mybatis的时候出现异常Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required,然后各种找日志百度,网上给了一种解决方法:

版本太高,使用手动注入sqlSessionFactory,然后用dao的实习类继承,因为我的项目没有dao 的实现类,直接是interface+mapper文件,所以直接忽略了,没有试过,想试一下可以试一下

阅读博客点这里(随手百度的):这里是传送门

    @Resource
    public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory){
        super.setSqlSessionFactory(sqlSessionFactory);
    }

然后有人说少了mybatis-spring-boot-starter jar包,然后我看的pom.xml文件,没有少

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

坑就出现在这里,因为我用了pagehelper-spring-boot-starter(这是github上一个分页的工具)里面有,和我引入的版本冲突了,把我引入的1.3.2版本的删了,项目就正常启动了,希望可有帮助你们

Springboot 2.0.4 整合Mybatis出现异常Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

原文地址:https://www.cnblogs.com/HackerBlog/p/9599334.html

时间: 2024-08-18 09:03:04

Springboot 2.0.4 整合Mybatis出现异常Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required的相关文章

spring boot 2.0.0 + mybatis 报:Property &#39;sqlSessionFactory&#39; or &#39;sqlSessionTemplate&#39; are required

spring boot 2.0.0 + mybatis 报:Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required 无法启动 google baidu了一番,多数都提示缺少: <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artif

springmvc与mybatis整合时 java.lang.IllegalArgumentException: Property &#39;sqlSessionFactory&#39; or &#39;sqlSessionTemplate&#39; are required 异常

今天在整合springmvc与mybatis时,启动服务器遇到这样一个问题, by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required at org.springframework.util.Assert.notNull(Assert.java:112) 异常的意思是  缺少sqlSessionFactory 或者是  sqlSessionTe

Spring整合Mybatis解决 Property &#39;sqlSessionFactory&#39; or &#39;sqlSessionTemplate&#39; are required

在Spring4和Mybatis3整合的时候,dao层注入'sqlSessionFactory'或'sqlSessionTemplate'会报错解决办法如下: package com.alibaba.webx.MyWebxTest.myWebX.module.dao.impl; import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.SqlSessionTemplate; import org.m

spring整合mybatis遇到的bug java.lang.IllegalArgumentException: Property &#39;sqlSessionFactory&#39; or &#39;sqlSessionTemplate&#39; are required

出bug的原因:mybatis-spring版本问题. 查看SqlSessionDaoSupport源码 1.2以上的版本: 1.1.1版本: 解决方法:1.2版本移除了@Autowired的注解,所以如果是1.2版本以上,要在BaseDaoImpl里面手动 注入SetSessionTemplate或者SetSessionFactory spring整合mybatis遇到的bug java.lang.IllegalArgumentException: Property 'sqlSessionFa

SpringBoot(十)-- 整合MyBatis

1.pom.xml 配置maven依赖 <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.0.0</version> </dependency> 2.一定要在启动的地方加上@MapperScan("com.xsjt

Spring整合MyBatis(三)sqlSessionFactory创建

摘要: 本文结合<Spring源码深度解析>来分析Spring 5.0.6版本的源代码.若有描述错误之处,欢迎指正. 目录 一.SqlSessionFactoryBean的初始化 二.获取 SqlSessionFactoryBean 实例 通过Spring整合MyBatis的示例,我们感受到了Spring为用户更加快捷地进行开发所做的努力,开发人员的工作效率由此得到了显著的提升.但是,相对于使用来说,我们更想知道其背后所隐藏的秘密,Spring整合MyBatis是如何实现的呢?通过分析整合示例

Spring和Mybatis整合过程中遇到的一个找不到sqlSessionFactory或sqlSessionTemplate的异常

先看启动web项目时IDEA控制台抛出的异常(红色部分): D:\tomcat-kafka-8080\bin\catalina.bat run [2017-04-16 03:14:47,718] Artifact Gradle : com.xbs:imcc : imcc-1.0-SNAPSHOT.war (exploded): Server is not connected. Deploy is not available. Using CATALINA_BASE: "C:\Users\SYJ\

springboot学习入门简易版八---springboot2.0多环境配置、整合mybatis mysql8+(19-20)

2.11 SpringBoot多环境配置(19)  application.properties中配置 Spring.profiles.active=prd 配置环境: Application-dev.properties 开发环境 Application-test.properties 测试环境 Application-uat.properties 用户测试环境 Application-prd.properties 生产环境 2.12 SpringBoot整合mybatis(20) 注意:使用

SpringBoot整合MYBATIS,多数据源,事务,支持JAVA -JAR 启动.

用了一段时间SpringBoot,之前配置MYBATIS ,在打包WAR 放到tomcat下正常,但是WAR已经过时了,现在流行直接打包JAR 丢到DOCKER 里,无奈JAR 启动的时候MAPPER 扫描有问题,只能说之前整合MYBATIS 的方式不对. 这次的整合应该是不存在加载顺序引起的问题,使用了一段时间,妥妥的,记录下来 pom.xml <parent> <groupId>org.springframework.boot</groupId> <artif