Introduce predicate for searching enclosing classes in MergedAnnotations #28207
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Overview
Due to the deprecation of
SearchStrategy.TYPE_HIERARCHY_AND_ENCLOSING_CLASSES
(see #28079), we will introduce a way for users to provide aPredicate<Class<?>>
that is used to decide when the enclosing class for the class supplied to the predicate should be searched.This will give the user complete control over the "enclosing classes" aspect of the search algorithm in
MergedAnnotations
.TYPE_HIERARCHY_AND_ENCLOSING_CLASSES
, a user can provideclazz -> true
as the predicate.ClassUtils::isInnerClass
as the predicate.ClassUtils::isStaticClass
as the predicate.TestContextAnnotationUtils
inspring-test
), the user can provide a custom predicate.Proposal
Based on the outcome of #28208, a
searchEnclosingClass
predicate could be supplied when using theTYPE_HIERARCHY
search strategy as follows.By limiting when a
searchEnclosingClass
predicate can be supplied in the fluent search API, we can prevent users from trying to supply such a predicate for otherSearchStrategy
types.The text was updated successfully, but these errors were encountered: