SpringBoot2.5.1+Mybatis-Plus3.4.3:(Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required)
项目引发这个问题:
Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.1</version>
<relativePath/>
</parent>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.3</version>
</dependency>
事故原因:之前还是好好地运行,结果加入了redis-seesion就变成这样了
上网百度:一大片的都是一下方案:
1.mybatis-plus版本问题.
2.加入druid的依赖
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.2.9</version>
</dependency>
3.去除数据源自动注入的
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
我一想,这个我项目本身就是用了druid依赖,而且这个版本的我之前运行过没问题呀
一定是使用redis-session这个依赖搞出的问题》
查看项目这个依赖,感觉没问题呀。。。
<!--session共享替换为redis-->
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
一想Springboot集成redis-session不可能是现在才有的,很早之前就有了,不可能没有启动器呀。于是加上一个这个启动器试一试
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
没想到OK了
+++++++
忽然又发现一个问题,多环境下的Springboot的配置不起作用啊》》》
我这是Springboot2.5+;
spring:
profiles:
active: prod
这个找不到application-prod.yml;明明有啊

这样写
config:
activate:
on-profile: "dev"
SpringBoot2.5.1+Mybatis-Plus3.4.3:(Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required)的更多相关文章
- SpringBoot+MyBatis整合报错Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
项目启动的时候报这个错误,这个问题我百度了一天,果然不出意外的还是没能解决,其中有一篇文章相对来说还是有点用的:https://blog.csdn.net/qq8693/article/details ...
- Caused by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required [ IDEA mybatis项目报错 ]
今天笔者用Springboot框架整合Mybatis做一个小小的项目: 代码写完,在运行项目时,IDEA给我报了3处错误: org.springframework.beans.factory.Unsa ...
- Springboot 2.0.4 整合Mybatis出现异常Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
在使用Springboot 2.0.4 整合Mybatis的时候出现异常Property 'sqlSessionFactory' or 'sqlSessionTemplate' are require ...
- spring boot 2.0.0 + mybatis 报:Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
spring boot 2.0.0 + mybatis 报:Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required 无法启动 ...
- springboot整合mybatis的时候报错Caused by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
今天闲来无事,学习springboot整合mybatis,在bilibili看视频学的,视频中在dao层的interface上面加上org.apache.ibatis.annotations.Mapp ...
- springmvc与mybatis整合时 java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required 异常
今天在整合springmvc与mybatis时,启动服务器遇到这样一个问题, by: java.lang.IllegalArgumentException: Property 'sqlSessionF ...
- MyBatis与Spring MVC结合时,使用DAO注入出现:Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
错误源自使用了这个例子:http://www.yihaomen.com/article/java/336.htm,如果运行时会出现如下错误: Invocation of init method fai ...
- Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'e ...
- 使用 Jenkins 打包成功后 运行 出现 Caused by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
linux 运行时 错误日志 Error starting ApplicationContext. To display the conditions report re-run your appli ...
- Spring整合Mybatis解决 Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
在Spring4和Mybatis3整合的时候,dao层注入'sqlSessionFactory'或'sqlSessionTemplate'会报错解决办法如下: package com.alibaba. ...
随机推荐
- 华南理工大学 Python第4章课后小测-1
1.(单选)下面程序的输出结果是: for c in "ComputerScience": print(c,end="") if c=="S" ...
- day38-IO流05
JavaIO流05 4.常用的类04 4.4节点流和处理流03 4.4.8打印流-PrintStream和PrintWriter 打印流只有输出流,没有输入流 1.简单介绍及应用 PrintStrea ...
- 基于 iframe 的微前端框架 —— 擎天
vivo 互联网前端团队- Jiang Zuohan 一.背景 VAPD是一款专为团队协作办公场景设计的项目管理工具,实践敏捷开发与持续交付,以「项目」为核心,融合需求.任务.缺陷等应用,使用敏捷迭代 ...
- 无线WIFI连接
家里的无线网络覆盖一直不全, 最近想改善一下.买了一个mercury的小路由器MW156RM 其实,我还是不理解WDS, repeater, bridge模式有什么区别. 目标就是实现最少的改动,保持 ...
- GitHub desktop常见问题及解决办法
1.There are unresolved conflicts in the working directory. 问题出现:A台电脑push代码后,可能新建了分支,然后B电脑打开GitHub de ...
- ACL和NAT
1 ACL 1.1 ACL的作用 1).用来对数据包做访问控制(丢弃或者放弃) 2).结合其他协议,用来匹配范围 1.2 ACL的工作原理 当数据包从接口经过时,由于接口启用了ACL,此时路由器会对报 ...
- kibana配置文件kibana.yml参数详解
server.port: 默认值: 5601 Kibana 由后端服务器提供服务,该配置指定使用的端口号. server.host: 默认值: "localhost" 指定后端服务 ...
- 使用 Dockerfile 的一些最佳实践
- 讲讲 tcp_tw_recycle,tcp_tw_reuse
文章转载自:https://mp.weixin.qq.com/s?__biz=MzI1MDgwNzQ1MQ==&mid=2247485332&idx=1&sn=59823ce1 ...
- ES重要配置解析
path.data和path.logs 如果您使用.zip或.tar.gz存档,则data和logs 目录是子文件夹$ES_HOME.如果这些重要文件夹保留在其默认位置,则在将Elasticsearc ...