Skip to content

Document @MockBean vs @MockitoBean migration compatibility #43348

Open
@sbrannen

Description

@sbrannen

Overview

Due to the deprecation of @MockBean and @SpyBean in favor of Spring Framework's new @MockitoBean and @MockitoSpyBean support, several users have raised issues in the Spring Framework issue tracker regarding incompatibilities between the two sets of annotations.

Although incompatibilities are to be expected, it is not immediately clear to users what the differences are.

To address that, the Framework team proposes that the Boot team introduce a new section in the Mocking and Spying Beans section of the reference docs that lists known differences and potential migration strategies.

This could perhaps be addressed via a "compatibility matrix" for the 4 annotations.

Since the deprecation of @MockBean and @SpyBean and the migration to @MockitoBean and @MockitoSpyBean are specific to Boot, the Framework team feels the migration/compatibility documentation would best reside in Boot's reference docs.

Ideally, members of the Boot and Framework teams could collaborate on compiling the compatibility matrix, and I'd be happy to assist with that.

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions