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

Warn users about the caching implications of @MockBean and @SpyBean #10182

Closed
sbrannen opened this issue Sep 6, 2017 · 1 comment
Closed
Assignees
Labels
type: documentation A documentation update
Milestone

Comments

@sbrannen
Copy link
Member

sbrannen commented Sep 6, 2017

The use of @MockBean and @SpyBean cause the configured test ApplicationContext to be cached under a different key in the context cache in the Spring TestContext Framework; however, this is not made apparent to users of Spring Boot's testing support, and the (potentially) undesirable side effects are not intuitive for the average user.

See related discussion on Stack Overflow.

At the very least, a warning should be included in the "Mocking and spying beans" section of the Spring Boot reference manual.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 6, 2017
@wilkinsona wilkinsona added priority: normal type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 26, 2017
@wilkinsona wilkinsona added this to the 2.0.0 milestone Sep 26, 2017
@philwebb philwebb modified the milestones: 2.0.0, 2.0.0.RC2 Jan 31, 2018
@snicoll snicoll self-assigned this Feb 8, 2018
@snicoll snicoll closed this as completed in 0f6a13c Feb 8, 2018
@sbrannen
Copy link
Member Author

sbrannen commented Feb 8, 2018

Thanks for adding the note to the reference manual!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

5 participants