Streamline AnnotationFilter usage with the MergedAnnotations API

MergedAnnotations provides 'from' variants with RepeatableContainers but without AnnotationFilter argument now, avoiding the need to refer to AnnotationFilter.PLAIN as a default at call sites.
This commit is contained in:
Juergen Hoeller
2019-09-04 12:18:49 +02:00
parent c8f430ee91
commit 3bc27e8d14
8 changed files with 100 additions and 52 deletions

View File

@@ -35,7 +35,6 @@ import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.beans.factory.config.EmbeddedValueResolver;
import org.springframework.core.annotation.AnnotationFilter;
import org.springframework.core.annotation.MergedAnnotation;
import org.springframework.core.annotation.MergedAnnotationPredicates;
import org.springframework.core.annotation.MergedAnnotations;
@@ -168,7 +167,7 @@ public class AnnotationJmxAttributeSource implements JmxAttributeSource, BeanFac
Class<? extends Annotation> containerAnnotationType) {
return MergedAnnotations.from(annotatedElement, SearchStrategy.TYPE_HIERARCHY,
RepeatableContainers.of(annotationType, containerAnnotationType), AnnotationFilter.PLAIN)
RepeatableContainers.of(annotationType, containerAnnotationType))
.stream(annotationType)
.filter(MergedAnnotationPredicates.firstRunOf(MergedAnnotation::getAggregateIndex))
.map(MergedAnnotation::withNonMergedAttributes)