Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractRoutingDataSource does not allow to unwrap the underlying datasource [SPR-9856] #14489

spring-projects-issues opened this issue Oct 3, 2012 · 1 comment
in: data type: enhancement


Copy link

@spring-projects-issues spring-projects-issues commented Oct 3, 2012

Hernan J. Gonzalez opened SPR-9856 and commented

#14404 fixed a faulty implementation of java.sql.Wrapper in DelegatingDataSource.

Now, AbstractRoutingDataSource does not override isWrapper() unwrap() methods. I think it should override them, so that the isInstance() matching is done, not with respect to the class itself (perhaps also with the class itself?) but also with the currently routed datasource.

Case in point: I have a RoutingDataSource than can either route to a org.apache.commons.dbcp.BasicDataSource pool or a plain jdbc datasource. I wanted to call myRoutingDataSource.isWrapperFor(org.apache.commons.dbcp.BasicDataSource.class) to check I'm using the pooled data source, and call unwrap() to retrieve the wrapped dbcp object (for debugging purposes). Currently, I have no way of doing that, AFAIK.

As an alternative, if this is not deemed correct for the semantics of java.sql.Wrapper (it might be debatable if the Wrapper interface was intented to have a inmutable behaviour, i'd say no), a public accesor to the underlying datasource should be provided.

Affects: 3.1 GA

Issue Links:

  • #14404 DelegatingDataSource incorrectly implements java.sql.Wrapper

Referenced from: commits 9ff640a, da8e2d6

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Oct 4, 2012

Sam Brannen commented

This issue is a follow up to #14404.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: data type: enhancement
None yet

No branches or pull requests

2 participants