解决springboot项目不配置数据源启动报错问题
作者:CL@NPU 时间:2022-04-27 23:12:21
springboot项目不配置数据源启动报错
spring boot默认会加载
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
在启动类上加上
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
就可以了。
springboot配置双数据源报错
配置多个数据源启动报错:
error querying database. Cause: java.lang.IllegalArgumentException: dataSource or dataSourceClassName or jdbcUrl is required
主要原因是在1.0 配置数据源的过程中主要是写成:
spring.datasource.url
和 spring.datasource.driverClassName
而在2.0升级之后需要变更成:
spring.datasource.jdbc-url
和 spring.datasource.driver-class-name
即可解决!
配置主从数据库时注意配置文件application.yml文件中数据源格式
来源:https://blog.csdn.net/weixin_39037925/article/details/107018348
标签:springboot,配置,数据源
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Java代码精简之道(推荐)
2023-07-28 02:00:05
MAC下如何设置JDK环境变量
2023-12-20 16:05:24
![](https://img.aspxhome.com/file/2023/8/72598_0s.jpg)
Mybatis打印替换占位符后的完整Sql教程
2023-11-08 22:56:13
![](https://img.aspxhome.com/file/2023/5/97785_0s.jpg)
线程池ThreadPoolExecutor并行处理实现代码
2022-10-13 23:44:01
浅谈Spring-cloud 之 sleuth 服务链路跟踪
2022-09-24 16:07:43
![](https://img.aspxhome.com/file/2023/7/68577_0s.png)
android从资源文件中读取文件流并显示的方法
2022-05-29 14:11:56
SpringBoot使用JWT实现登录验证的方法示例
2023-09-19 19:12:10
![](https://img.aspxhome.com/file/2023/9/63689_0s.png)
在WinForm应用程序中快速实现多语言的处理的方法
2023-07-26 10:39:55
![](https://img.aspxhome.com/file/2023/6/92896_0s.png)
JavaFx 实现按钮防抖功能
2023-03-20 07:34:48
![](https://img.aspxhome.com/file/2023/3/88213_0s.gif)
springboot 整合hbase的示例代码
2023-02-11 19:35:20
![](https://img.aspxhome.com/file/2023/4/60924_0s.png)
kafka的消息存储机制和原理分析
2022-02-01 13:07:39
![](https://img.aspxhome.com/file/2023/0/100050_0s.png)
SSH原理及两种登录方法图文详解
2023-11-14 11:10:53
![](https://img.aspxhome.com/file/2023/8/59038_0s.png)
浅谈java安全编码指南之死锁dead lock
2023-06-22 04:49:19
WPF实现控件拖动的示例代码
2023-04-01 09:36:15
SpringBoot框架集成ElasticSearch实现过程示例详解
2023-02-02 08:44:05
![](https://img.aspxhome.com/file/2023/7/70487_0s.png)
Log4j新手快速入门教程
2023-06-01 11:59:44
![](https://img.aspxhome.com/file/2023/0/91740_0s.png)
关于mybatis resulttype 返回值异常的问题
2021-08-09 20:26:19
Java MyBatis可视化代码生成工具使用教程
2022-12-05 15:23:39
![](https://img.aspxhome.com/file/2023/6/77116_0s.png)
Java 实战项目之毕业设计管理系统的实现流程
2021-12-26 00:10:10
![](https://img.aspxhome.com/file/2023/4/74994_0s.png)
WPF实现窗体中的悬浮按钮
2022-07-25 17:45:53
![](https://img.aspxhome.com/file/2023/2/94652_0s.jpg)