答案 0 :(得分:0)
禁用默认数据源运行状况指示器
management.health.db.enabled=false
并使用DataSourceHealthIndicator自定义所需的数据源
示例:
@Autowired
private DataSource requiredDataSource;
@Bean
public DataSourceHealthIndicator requiredDataSourceHealthIndicator() {
return new DataSourceHealthIndicator(requiredDataSource);
}