Honor classValuesAsString in getMergedRepeatableAnnotationAttributes()

Closes gh-31768
This commit is contained in:
Sam Brannen
2023-12-06 12:09:39 +01:00
parent 6b53f37030
commit 448e753184
2 changed files with 8 additions and 6 deletions

View File

@@ -325,11 +325,13 @@ class AnnotationMetadataTests {
private static void assertRepeatableAnnotations(AnnotationMetadata metadata) {
Set<AnnotationAttributes> attributesSet =
metadata.getMergedRepeatableAnnotationAttributes(TestComponentScan.class, TestComponentScans.class, false);
metadata.getMergedRepeatableAnnotationAttributes(TestComponentScan.class, TestComponentScans.class, true);
assertThat(attributesSet.stream().map(attributes -> attributes.getStringArray("value")).flatMap(Arrays::stream))
.containsExactly("A", "B", "C", "D");
assertThat(attributesSet.stream().map(attributes -> attributes.getStringArray("basePackages")).flatMap(Arrays::stream))
.containsExactly("A", "B", "C", "D");
assertThat(attributesSet.stream().map(attributes -> attributes.getStringArray("basePackageClasses")).flatMap(Arrays::stream))
.containsExactly("java.lang.String", "java.lang.Integer");
}
private static void assertRepeatableAnnotationsSortedByReversedMetaDistance(AnnotationMetadata metadata) {
@@ -693,16 +695,16 @@ class AnnotationMetadataTests {
public @interface ScanPackagesCandD {
}
@TestComponentScan("A")
@TestComponentScan(basePackages = "A", basePackageClasses = String.class)
@ScanPackageC
@ScanPackageD
@TestComponentScan("B")
@TestComponentScan(basePackages = "B", basePackageClasses = Integer.class)
static class MultipleComposedRepeatableAnnotationsClass {
}
@TestComponentScan("A")
@TestComponentScan(basePackages = "A", basePackageClasses = String.class)
@ScanPackagesCandD
@TestComponentScans(@TestComponentScan("B"))
@TestComponentScans(@TestComponentScan(basePackages = "B", basePackageClasses = Integer.class))
static class MultipleRepeatableAnnotationsInContainersClass {
}