【问题标题】:Is it possible to disable a Spring Boot datasource configuration based on unavailability of a connection to a DB是否可以根据与数据库的连接不可用来禁用 Spring Boot 数据源配置
【发布时间】:2020-04-28 14:15:26
【问题描述】:

我们有一个使用多个数据源的应用程序。目前,这些数据源之一的数据库已关闭:IOError. Network adapter couldn't establish the connection & Socket read timed out

是否有注释(或其他方式)配置 Spring Boot,使其绕过罪魁祸首数据源并仍然启动:DB 在当前开发工作中不是必需的。 spring.datasource.continue-on-error=true 似乎不起作用。这是 Spring 2.2.2.RELEASE。

【问题讨论】:

    标签: spring spring-boot configuration


    【解决方案1】:

    使用多个数据源,因此当您的应用程序在启动时失败时,您的应用程序仍然可以工作,我的意思是使用内存 db / sqlite 来处理连接错误时失败...

    【讨论】:

      猜你喜欢
      • 2018-11-10
      • 2018-06-14
      • 2019-06-17
      • 2021-05-14
      • 2019-02-07
      • 1970-01-01
      • 2016-01-17
      • 2015-01-26
      相关资源
      最近更新 更多