Conversation
jjh75607
added a commit
to jjh75607/spring-boot
that referenced
this pull request
Aug 22, 2026
See spring-projectsgh-51410 Signed-off-by: jjh75607 <jjh7560734@gmail.com>
jjh75607
force-pushed
the
fix/unwrap-root-honours-wrapper-unwrap-41x
branch
from
August 22, 2026 09:17
0b29a18 to
af23bb6
Compare
See spring-projectsgh-51410 Signed-off-by: jjh75607 <jjh7560734@gmail.com>
snicoll
force-pushed
the
fix/unwrap-root-honours-wrapper-unwrap-41x
branch
from
August 24, 2026 08:49
af23bb6 to
d5cec29
Compare
Member
|
Thanks @jjh75607 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DataSourceUnwrapper.unwrapRootchecks the delegate chain and the AOP target before itlooks at
Wrapper.unwrap, and it stops as soon as a wrapper unwraps to itself.unwrap(DataSource, Class, Class), right above it, does the opposite and callssafeUnwrapfirst.DecoratedDataSourcefrom spring-boot-data-source-decorator 2.0.1 extendsDelegatingDataSourceand overridesunwrapto return theHikariDataSource, but itstarget is datasource-proxy's
ProxyDataSource. Following the delegate chain lands on theproxy, and a
Wrapperthat implements the requested interface is meant to return itselffrom
unwrap. The search therefore ends at the proxy andDecoratedDataSource.unwrapnever runs.
DataSourceBuilder.derivedFromis the only caller, so it derives from the proxy insteadof the pool. Nothing throws. Reported downstream as
gavlyukovskiy/spring-boot-data-source-decorator#197.
This calls
unwrapfirst and keeps going through the delegate chain and the AOP targetwhen a wrapper returns itself.
DelegatingDataSourceandLazyConnectionDataSourceProxyboth return themselves, so the delegate chain still handles them and the lazy connection
proxy case from #50271 is unaffected. The new test fails on 4.1.x without the change.