Skip to content

Remove proxyTargetAware attribute from @MockitoSpyBean #33775

Closed
@sbrannen

Description

@sbrannen

Overview

During my recent analysis of our @MockitoSpyBean support, it became apparent that we do not need the proxyTargetAware 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 to true 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 to false.

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 when proxyTargetAware was set to true (the default value for the attribute).

Related Issues

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions