Merge branch '5.3.x'

# Conflicts:
#	spring-core/src/main/java/org/springframework/core/annotation/TypeMappedAnnotation.java
This commit is contained in:
Sam Brannen
2022-06-25 20:14:27 +02:00
6 changed files with 80 additions and 26 deletions

View File

@@ -1539,6 +1539,17 @@ class MergedAnnotationsTests {
assertThat(generatedValue).isSameAs(synthesizedGeneratedValue);
}
@Test
void synthesizeShouldNotSynthesizeNonsynthesizableAnnotationsWhenUsingMergedAnnotationsFromApi() {
MergedAnnotations mergedAnnotations = MergedAnnotations.from(SecurityConfig.class);
EnableWebSecurity enableWebSecurity = mergedAnnotations.get(EnableWebSecurity.class).synthesize();
assertThat(enableWebSecurity).isNotInstanceOf(SynthesizedAnnotation.class);
EnableGlobalAuthentication enableGlobalAuthentication = mergedAnnotations.get(EnableGlobalAuthentication.class).synthesize();
assertThat(enableGlobalAuthentication).isNotInstanceOf(SynthesizedAnnotation.class);
}
/**
* If an attempt is made to synthesize an annotation from an annotation instance
* that has already been synthesized, the original synthesized annotation should
@@ -3216,6 +3227,25 @@ class MergedAnnotationsTests {
return 42L;
}
/**
* Mimics org.springframework.security.config.annotation.authentication.configuration.EnableGlobalAuthentication
*/
@Retention(RUNTIME)
@interface EnableGlobalAuthentication {
}
/**
* Mimics org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
*/
@Retention(RUNTIME)
@EnableGlobalAuthentication
@interface EnableWebSecurity {
}
@EnableWebSecurity
static class SecurityConfig {
}
@Retention(RetentionPolicy.RUNTIME)
@interface TestConfiguration {