Skip to content

Commit 4217352

Browse files
committed
Consume KeySpace annotation values without synthesizing the annotation.
Closes #449
1 parent f2cd88e commit 4217352

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/org/springframework/data/keyvalue/core/mapping/AnnotationBasedKeySpaceResolver.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*/
1616
package org.springframework.data.keyvalue.core.mapping;
1717

18-
import org.springframework.core.annotation.AnnotatedElementUtils;
19-
import org.springframework.core.annotation.AnnotationUtils;
18+
import org.springframework.core.annotation.MergedAnnotation;
19+
import org.springframework.core.annotation.MergedAnnotations;
2020
import org.springframework.data.annotation.Persistent;
2121
import org.springframework.data.keyvalue.annotation.KeySpace;
2222
import org.springframework.lang.Nullable;
@@ -50,10 +50,11 @@ public String resolveKeySpace(Class<?> type) {
5050
@Nullable
5151
private static Object getKeySpace(Class<?> type) {
5252

53-
KeySpace keyspace = AnnotatedElementUtils.findMergedAnnotation(type, KeySpace.class);
53+
MergedAnnotation<KeySpace> annotation = MergedAnnotations
54+
.from(type, MergedAnnotations.SearchStrategy.TYPE_HIERARCHY).get(KeySpace.class);
5455

55-
if (keyspace != null) {
56-
return AnnotationUtils.getValue(keyspace);
56+
if (annotation.isPresent()) {
57+
return annotation.getValue("value").orElse(null);
5758
}
5859

5960
return null;

0 commit comments

Comments
 (0)