Skip to content

Commit 6f4b26b

Browse files
committed
DATACMNS-611 - Improved cache lookups in RepositoryInterfaceAwareBeanPostProcessor.
Refactored predictBeanType(…) to only look up the predicted cached type once. Related pull request: #108.
1 parent 71f1592 commit 6f4b26b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/org/springframework/data/repository/core/support/RepositoryInterfaceAwareBeanPostProcessor.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2008-2011 the original author or authors.
2+
* Copyright 2008-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -70,15 +70,15 @@ public Class<?> predictBeanType(Class<?> beanClass, String beanName) {
7070
return null;
7171
}
7272

73-
BeanDefinition definition = context.getBeanDefinition(beanName);
74-
PropertyValue value = definition.getPropertyValues().getPropertyValue("repositoryInterface");
75-
7673
Class<?> resolvedBeanClass = cache.get(beanName);
7774

78-
if (cache.containsKey(beanName)) {
79-
return cache.get(beanName);
75+
if (resolvedBeanClass != null) {
76+
return resolvedBeanClass == Void.class ? null : resolvedBeanClass;
8077
}
8178

79+
BeanDefinition definition = context.getBeanDefinition(beanName);
80+
PropertyValue value = definition.getPropertyValues().getPropertyValue("repositoryInterface");
81+
8282
resolvedBeanClass = getClassForPropertyValue(value, beanName);
8383
cache.put(beanName, resolvedBeanClass);
8484

0 commit comments

Comments
 (0)