Fix gh-27348
Comment From: quaff
@sbrannen Do you consider this for 6.1?
Comment From: jhoeller
We intentionally separated those utility methods. I'm afraid those AOP test methods are potentially unsafe since they never release the target instance that they take from the TargetSource
there. That might not matter for an eagerly initialized singleton target in a test but generally speaking such a step is not side effect free. Overall, these methods do not represent idiomatic usage of the AOP framework and are therefore not to be promoted as proper utilities in AopUtils
itself.
That said, if such a step works for you for a certain purpose, feel free to mimic/copy it into wherever you need it. Just be aware of those TargetSource
side effects. Internal discovery of a target instance for a certain purpose is easier to justify than doing so in a general public utility, after all.