boot版本配置多数据库失败

Blade 未结 4 1271
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条回答
  •  yoeaki
    yoeaki (楼主)
    2022-07-14 11:38

    1. 这个需要在启动类排除原来的数据源

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

提交回复