Skip to content

Add beans created using @MockBean as singletons rather than via a bean definition #6664

@wilkinsona

Description

@wilkinsona

When registered via a bean definition the mock is subject to post-processing. This includes creation of proxies for caching and async processing. It also means that the container attempts to autowire the mock's fields (if it was created from a class rather than an interface). We could avoid this by adding the bean to the bean factory as a singleton.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions