From c343a6563236f5db5f894fd433dcd99c2141aba2 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Mon, 8 Dec 2014 17:51:17 +0100 Subject: [PATCH] DATACMNS-611 - Improved cache lookups in RepositoryInterfaceAwareBeanPostProcessor. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactored predictBeanType(…) to only look up the predicted cached type once. Related pull request: #108. --- .../RepositoryInterfaceAwareBeanPostProcessor.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/springframework/data/repository/core/support/RepositoryInterfaceAwareBeanPostProcessor.java b/src/main/java/org/springframework/data/repository/core/support/RepositoryInterfaceAwareBeanPostProcessor.java index 17ca5d6be..b42e51aa2 100644 --- a/src/main/java/org/springframework/data/repository/core/support/RepositoryInterfaceAwareBeanPostProcessor.java +++ b/src/main/java/org/springframework/data/repository/core/support/RepositoryInterfaceAwareBeanPostProcessor.java @@ -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);