Skip to content

Conversation

nosan
Copy link
Contributor

@nosan nosan commented Sep 14, 2024

Currently, the logic inside DataSourceHealthContributorAutoConfiguration auto-configuration is based solely on instanceof and does not account for situations where someone has added a proxy/wrapper around AbstractRoutingDataSource through BeanPostProcessor or other ways.

@nosan nosan changed the title Used DataSource.unwrap method alongside with 'instance of' for determining AbstractRoutingDataSource Used DataSource.unwrap method alongside with 'instanceof' for determining AbstractRoutingDataSource Sep 14, 2024
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 14, 2024
@philwebb philwebb added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 14, 2024
@philwebb philwebb added this to the 3.2.x milestone Sep 14, 2024
@nosan nosan force-pushed the datasourcehealthcontributor-routingdatasource branch from ae7c9ad to d5aa1a9 Compare September 15, 2024 08:47
@snicoll snicoll self-assigned this Sep 16, 2024
@wilkinsona wilkinsona changed the title Used DataSource.unwrap method alongside with 'instanceof' for determining AbstractRoutingDataSource management.health.db.ignore-routing-datasources=true has no effect when an AbstractRoutingDataSource has been wrapped Sep 16, 2024
snicoll pushed a commit that referenced this pull request Sep 16, 2024
This commit uses DataSource.isWrapperFor and DataSource.unwrap to detect if a DataSource is an AbstractRoutingDataSource. Previously, it relied on instanceof which does not account for cases where the datasource has been proxied. See gh-42313
@snicoll snicoll closed this in ece9cb3 Sep 16, 2024
@snicoll
Copy link
Member

snicoll commented Sep 16, 2024

Thanks again @nosan!

@nosan nosan deleted the datasourcehealthcontributor-routingdatasource branch September 16, 2024 07:53
@snicoll snicoll modified the milestones: 3.2.x, 3.2.10 Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
4 participants