boot版本配置多数据库失败

Blade 未结 4 981
18894961962
18894961962 剑者 2022-07-13 18:04

一、该问题的重现步骤是什么?

  1. autoconfigure:
        exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
      datasource:
        dynamic:
          primary: master
          strict: false
          datasource:
            master:
              url: jdbc:mysql://*****************?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
              username: *****************
              password: *****************
            slave:
              url: jdbc:mysql://*****************?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
              username: *****************
              password: *****************

***************************

APPLICATION FAILED TO START

***************************


Description:


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


Reason: Failed to determine suitable jdbc url



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 (the profiles dev are currently active).

3.boot版本2.9.1版本配置多数据库时启动失败


二、你期待的结果是什么?实际看到的又是什么?


三、你正在使用的是什么产品,什么版本?在什么操作系统上?


四、请提供详细的错误堆栈信息,这很重要。


五、若有更多详细信息,请在下面提供。


4条回答
  • 2022-07-13 22:58

    多数据源配置你可能漏了一个,看下文档这里有说明,更多说明见:https://sns.bladex.cn/q-5408.html

    image.png


    0 讨论(0)
  • 2022-07-14 09:24

    我也遇到相同问题,如果解决了,请回复我下。如果我先解决我也会来帖子留言的

    0 讨论(1)
  • 2022-07-14 11:38
    1. 这个需要在启动类排除原来的数据源

    2. 还需要启动多数据源设置

    0 讨论(1)
  • 2022-07-14 23:36

    在启动类那里开启多数据源,同时关闭多租户的数据库隔离

    0 讨论(1)
提交回复