Remove proxyTargetAware
attribute from @MockitoSpyBean
#33775
Labels
Milestone
proxyTargetAware
attribute from @MockitoSpyBean
#33775
Overview
During my recent analysis of our
@MockitoSpyBean
support, it became apparent that we do not need theproxyTargetAware
attribute.The
proxyTargetAware
attribute was originally introduced in Spring Boot's@SpyBean
support in order to address spring-projects/spring-boot#5837; however, Spring Framework's@MockitoSpyBean
support works differently and does not modify existing Spring AOP advice chains. In other words, setting that flag totrue
does not make anything "proxy target aware". In addition, we are not aware of any compelling use cases for which one would want to set that flag tofalse
.In light of the above, we should remove the
proxyTargetAware
attribute from@MockitoSpyBean
while keeping the underlying feature in tact (i.e., transparent verification for spies created via@MockitoSpyBean
), which was the behavior whenproxyTargetAware
was set totrue
(the default value for the attribute).Related Issues
@MockitoSpyBean
does not support transparent verification #33774The text was updated successfully, but these errors were encountered: