Merge branch '5.3.x'
# Conflicts: # spring-core/src/test/java/org/springframework/core/annotation/MergedAnnotationsTests.java
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -173,7 +173,7 @@ import java.lang.annotation.Target;
|
||||
* @author Sam Brannen
|
||||
* @since 4.2
|
||||
* @see MergedAnnotations
|
||||
* @see SynthesizedAnnotation
|
||||
* @see AnnotationUtils#isSynthesizedAnnotation(Annotation)
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,7 +25,7 @@ import org.springframework.core.NestedRuntimeException;
|
||||
* @author Sam Brannen
|
||||
* @since 4.2
|
||||
* @see AnnotationUtils
|
||||
* @see SynthesizedAnnotation
|
||||
* @see AnnotationUtils#isSynthesizedAnnotation(java.lang.annotation.Annotation)
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class AnnotationConfigurationException extends NestedRuntimeException {
|
||||
|
||||
@@ -1185,7 +1185,7 @@ public abstract class AnnotationUtils {
|
||||
public static <A extends Annotation> A synthesizeAnnotation(
|
||||
A annotation, @Nullable AnnotatedElement annotatedElement) {
|
||||
|
||||
if (annotation instanceof SynthesizedAnnotation || AnnotationFilter.PLAIN.matches(annotation)) {
|
||||
if (isSynthesizedAnnotation(annotation) || AnnotationFilter.PLAIN.matches(annotation)) {
|
||||
return annotation;
|
||||
}
|
||||
return MergedAnnotation.from(annotatedElement, annotation).synthesize();
|
||||
@@ -1279,6 +1279,18 @@ public abstract class AnnotationUtils {
|
||||
return synthesized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the supplied {@link Annotation} has been <em>synthesized</em>
|
||||
* by Spring (i.e. wrapped in a dynamic proxy) with additional functionality
|
||||
* such as attribute alias handling.
|
||||
* @param annotation the annotation to check
|
||||
* @return {@code true} if the supplied annotation is a synthesized annotation
|
||||
* @since 5.3.23
|
||||
*/
|
||||
public static boolean isSynthesizedAnnotation(@Nullable Annotation annotation) {
|
||||
return (annotation instanceof SynthesizedAnnotation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the internal annotation metadata cache.
|
||||
* @since 4.3.15
|
||||
|
||||
Reference in New Issue
Block a user