SONARJAVA-5291 Modify rule S7177: specify spring context (#4623)

This commit is contained in:
leonardo-pilastri-sonarsource 2025-01-28 10:57:27 +01:00 committed by GitHub
parent 1e62d9fef8
commit 8940eee53e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,6 @@
== Why is this an issue?
The `@DirtiesContext` annotation marks the ApplicationContext as dirty and indicates that it should be cleared and recreated.
In a Spring application, the `@DirtiesContext` annotation marks the ApplicationContext as dirty and indicates that it should be cleared and recreated.
This is important in tests that modify the context, such as altering the state of singleton beans or databases.
Misconfiguring `@DirtiesContext` by setting the `methodMode` at the class level or the `classMode` at the method level will make the annotation have no effect.