Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate @MockBean and @SpyBean #39864

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wanger26
Copy link
Contributor

Change Summary

  • Deprecate Deprecate @MockBean and @SpyBean in favor of Spring Framekworks 6.2.0 @MockitoBean and @MockitoSpy. See spring-projects/spring-framework@e1bbdf0
  • Migrate usages of @MockBean and @SpyBean to @MockitoBean an d @MockitoSpy

Issue

- Deprecate Deprecate @MockBean and @SpyBean in favor of Spring Framekworks 6.2.0 @MockitoBean and @MockitoSpy. See spring-projects/spring-framework@e1bbdf0
- Migrate usages of @MockBean and @SpyBean to @MockitoBean an d @MockitoSpy

spring-projects#39860

Signed-off-by: Jakob Wanger <jakobwanger@gmail.com>
@wanger26 wanger26 marked this pull request as draft March 10, 2024 23:49
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 10, 2024
@snicoll
Copy link
Member

snicoll commented Mar 11, 2024

FTR, I am maintaining a branch of the changes required to upgrade to SF 6.2.0-SNAPSHOT and some of the changes in this PR are already applied there, which I intend to submit once Spring Boot is ready to build against it.

@philwebb philwebb changed the title CHORE - Deprecate @MockBean and @SpyBean Deprecate @MockBean and @SpyBean Mar 11, 2024
@philwebb philwebb added this to the 3.x milestone Mar 11, 2024
@philwebb philwebb added status: on-hold We can't start working on this issue yet for: merge-with-amendments Needs some changes when we merge and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 11, 2024
@wanger26
Copy link
Contributor Author

Closing PR /draft based on comments above.

@wanger26 wanger26 closed this Mar 11, 2024
@philwebb
Copy link
Member

@wanger26 Can we keep this one? It's likely that @snicoll won't migrate the existing tests and the work you've done here looks valuable for us.

@philwebb philwebb reopened this Mar 11, 2024
@wanger26
Copy link
Contributor Author

wanger26 commented Mar 11, 2024

Sounds good, that is no problem 👍

@snicoll
Copy link
Member

snicoll commented Mar 12, 2024

Here is what's needed so far to get a green build with Spring Framework 6.2.0-SNAPSHOT: https://github.com/snicoll/spring-boot/tree/compat-6.2.x

Regarding Mockito support, I had to remove the automatic intialization of mocks as the support in the core framework does that now and they were trumping each other. Given that the support is going to be deprecated, tests should still use the existing infrastructure, rather than moving to the new annotations. It's a different story for smoke tests & co though.

@wanger26
Copy link
Contributor Author

Here is what's needed so far to get a green build with Spring Framework 6.2.0-SNAPSHOT: https://github.com/snicoll/spring-boot/tree/compat-6.2.x

Regarding Mockito support, I had to remove the automatic intialization of mocks as the support in the core framework does that now and they were trumping each other. Given that the support is going to be deprecated, tests should still use the existing infrastructure, rather than moving to the new annotations. It's a different story for smoke tests & co though.

Should we leave all tests using the Mockito outside of smoke tests and co untouched, or should we only leave the unit tests for the Mockito support untouched?

@scottfrederick scottfrederick modified the milestones: 3.x, 3.4.x Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: merge-with-amendments Needs some changes when we merge status: on-hold We can't start working on this issue yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants