Description
Overview
The TYPE_HIERARCHY_AND_ENCLOSING_CLASSES
search strategy for MergedAnnotations
was originally introduced to support @Nested
test classes in JUnit Jupiter.
However, while implementing #19930, we determined that the TYPE_HIERARCHY_AND_ENCLOSING_CLASSES
search strategy unfortunately could not be used since it does not allow the user to control when to recurse up the enclosing class hierarchy. For example, this search strategy will automatically search on enclosing classes for static nested classes as well as for inner classes, when the user probably only wants one such category of "enclosing class" to be searched. Consequently, TestContextAnnotationUtils
was introduced in the Spring TestContext Framework to address the shortcomings of the TYPE_HIERARCHY_AND_ENCLOSING_CLASSES
search strategy.
Since this search strategy is unlikely to be useful to general users, the team should consider deprecating this search strategy in Spring Framework 6.0.