Skip to content

When using @MockitoBean and @MockitoSpyBean make it easier to inject any underlying proxy target as well as the mock or spy #33743

Open
@wilkinsona

Description

@wilkinsona

We'd like to support something like this:

@MockitoSpyBean
ProxiedBean<Service> service;

ProxiedBean would then provide accessors for the bean both with and without all of its Spring proxies. This should make it easier to bypass any caching or advice when, for example, setting expectations, while having them in place when exercising the service.

Hopefully this will address spring-projects/spring-boot#22281 by providing a nicer API that can be used in place of AopTestUtils.getTargetObject(service).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions