springboot+maven dynamic-datasource 动态切换数据源,启动报错

CSDN问答 2021-12-30 13:51:02 阅读数:391

SpringBoot maven dynamic dynamic-datasource springboot+maven

遇到问题
Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class

Action:

Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).




采纳答案:

看错误信息应该是你的properties配置文件中没有配置数据源吧
spring.datasource.dynamic.datasource.master.url



其他答案2:

看你都发了无数次了,做一次好人吧,拿去自己改一下数据源的配置就行了
链接: https://pan.baidu.com/s/1WeyLNisRLlbKVUwlXB4fSQ 提取码: rqq2 复制这段内容后打开百度网盘手机App,操作更方便哦


其他答案3:

已解决,
解决方法:启动类@SpringBootApplication(exclude= {DruidDataSourceAutoConfigure.class}),注意是DruidDataSourceAutoConfigure,不是DataSourceAutoConfiguration.class

版权声明:本文为[CSDN问答]所创,转载请带上原文链接,感谢。 https://ask.csdn.net/questions/7613134