From 413341a1aa9bc5245c46b1ac17335f8a44c1ec31 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Wed, 29 Dec 2010 12:54:28 +0100 Subject: [PATCH] Extended callback methods to take repository interface into account when creating repository backing object. As factory implementations might have to inspect the actual repository interface to select a concrete repository implementation, we have to hand the interface to the methods returning the class and returning the actual object. --- .../repository/support/RepositoryFactorySupport.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/spring-data-commons-core/src/main/java/org/springframework/data/repository/support/RepositoryFactorySupport.java b/spring-data-commons-core/src/main/java/org/springframework/data/repository/support/RepositoryFactorySupport.java index bc00e6b63..aa9ea9dc9 100644 --- a/spring-data-commons-core/src/main/java/org/springframework/data/repository/support/RepositoryFactorySupport.java +++ b/spring-data-commons-core/src/main/java/org/springframework/data/repository/support/RepositoryFactorySupport.java @@ -117,7 +117,8 @@ public abstract class RepositoryFactorySupport { validate(repositoryInterface, customImplementation); Class domainClass = getDomainClass(repositoryInterface); - RepositorySupport target = getTargetRepository(domainClass); + RepositorySupport target = + getTargetRepository(domainClass, repositoryInterface); // Create proxy ProxyFactory result = new ProxyFactory(); @@ -144,7 +145,7 @@ public abstract class RepositoryFactorySupport { * @return */ protected abstract RepositorySupport getTargetRepository( - Class domainClass); + Class domainClass, Class repositoryInterface); /** @@ -153,7 +154,8 @@ public abstract class RepositoryFactorySupport { * @return */ @SuppressWarnings("rawtypes") - protected abstract Class getRepositoryClass(); + protected abstract Class getRepositoryClass( + Class repositoryInterface); /** @@ -238,7 +240,8 @@ public abstract class RepositoryFactorySupport { } result = - getBaseClassMethodFor(method, getRepositoryClass(), + getBaseClassMethodFor(method, + getRepositoryClass(repositoryInterface), repositoryInterface); methodCache.put(method, result);