DATACMNS-611 - Improved cache lookups in RepositoryInterfaceAwareBeanPostProcessor.

Refactored predictBeanType(…) to only look up the predicted cached type once.

Related pull request: #108.
This commit is contained in:
Oliver Gierke
2014-12-08 17:51:17 +01:00
parent d8781888d8
commit c343a65632

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2011 the original author or authors.
* Copyright 2008-2014 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.
@@ -70,15 +70,15 @@ class RepositoryInterfaceAwareBeanPostProcessor extends InstantiationAwareBeanPo
return null;
}
BeanDefinition definition = context.getBeanDefinition(beanName);
PropertyValue value = definition.getPropertyValues().getPropertyValue("repositoryInterface");
Class<?> resolvedBeanClass = cache.get(beanName);
if (cache.containsKey(beanName)) {
return cache.get(beanName);
if (resolvedBeanClass != null) {
return resolvedBeanClass == Void.class ? null : resolvedBeanClass;
}
BeanDefinition definition = context.getBeanDefinition(beanName);
PropertyValue value = definition.getPropertyValues().getPropertyValue("repositoryInterface");
resolvedBeanClass = getClassForPropertyValue(value, beanName);
cache.put(beanName, resolvedBeanClass);