abbott_001 2021-12-23 15:21 采纳率: 42.9%
浏览 83
已结题

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

遇到问题
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).

  • 写回答

3条回答 默认 最新

  • abbott_001 2021-12-24 16:12
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 1月12日
  • 已采纳回答 1月4日
  • 修改了问题 12月23日
  • 创建了问题 12月23日