-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed
Labels
type: regressionA regression from a previous releaseA regression from a previous release
Milestone
Description
DataSourceHealthContributorAutoConfiguration loads all DataSources. And monitoring all data sources with an actuator.
It ignores AbstractRoutingDataSource... So it's a good implementation since the destination of AbstractRoutingDataSource may change.
Lines 79 to 96 in b43827d
| @Bean | |
| @ConditionalOnMissingBean(name = { "dbHealthIndicator", "dbHealthContributor" }) | |
| public HealthContributor dbHealthContributor(Map<String, DataSource> dataSources) { | |
| return createContributor(filterDataSources(dataSources)); | |
| } | |
| private Map<String, DataSource> filterDataSources(Map<String, DataSource> candidates) { | |
| if (candidates == null) { | |
| return null; | |
| } | |
| Map<String, DataSource> dataSources = new LinkedHashMap<>(); | |
| candidates.forEach((name, dataSource) -> { | |
| if (!(dataSource instanceof AbstractRoutingDataSource)) { | |
| dataSources.put(name, dataSource); | |
| } | |
| }); | |
| return dataSources; | |
| } |
But createContributor throws an exception when the argument is empty.
Lines 51 to 57 in b43827d
| protected final C createContributor(Map<String, B> beans) { | |
| Assert.notEmpty(beans, "Beans must not be empty"); | |
| if (beans.size() == 1) { | |
| return createIndicator(beans.values().iterator().next()); | |
| } | |
| return createComposite(beans); | |
| } |
As a result, if the module have only AbstractRoutingDataSources, boot application can't run.
kazuki-ma
Metadata
Metadata
Assignees
Labels
type: regressionA regression from a previous releaseA regression from a previous release