From 572e48b4b6bea6269679d4cc615304e6df58fa6b Mon Sep 17 00:00:00 2001 From: "A.J. Brown" Date: Fri, 15 May 2015 16:06:59 -0400 Subject: [PATCH] DATACOUCH-126: add the repositoryBaseClass annotation attribute. The repositoryBaseClass attribute is needed for spring-data-commons 1.4 support. Without it, an assertion fails while spring is trying to configure the repositories enabled by this annotation,. --- .../repository/config/EnableCouchbaseRepositories.java | 8 ++++++++ .../repository/support/CouchbaseRepositoryFactory.java | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/springframework/data/couchbase/repository/config/EnableCouchbaseRepositories.java b/src/main/java/org/springframework/data/couchbase/repository/config/EnableCouchbaseRepositories.java index 5c654675..a96cdef9 100644 --- a/src/main/java/org/springframework/data/couchbase/repository/config/EnableCouchbaseRepositories.java +++ b/src/main/java/org/springframework/data/couchbase/repository/config/EnableCouchbaseRepositories.java @@ -19,6 +19,7 @@ package org.springframework.data.couchbase.repository.config; import org.springframework.context.annotation.ComponentScan.Filter; import org.springframework.context.annotation.Import; import org.springframework.data.couchbase.repository.support.CouchbaseRepositoryFactoryBean; +import org.springframework.data.repository.config.DefaultRepositoryBaseClass; import java.lang.annotation.*; @@ -82,6 +83,13 @@ public @interface EnableCouchbaseRepositories { */ String namedQueriesLocation() default ""; + /** + * Configure the repository base class to be used to create repository proxies for this particular configuration. + * + * @return + */ + Class repositoryBaseClass() default DefaultRepositoryBaseClass.class; + /** * Returns the {@link FactoryBean} class to be used for each repository instance. Defaults to diff --git a/src/main/java/org/springframework/data/couchbase/repository/support/CouchbaseRepositoryFactory.java b/src/main/java/org/springframework/data/couchbase/repository/support/CouchbaseRepositoryFactory.java index f7c87c26..4371c475 100644 --- a/src/main/java/org/springframework/data/couchbase/repository/support/CouchbaseRepositoryFactory.java +++ b/src/main/java/org/springframework/data/couchbase/repository/support/CouchbaseRepositoryFactory.java @@ -19,13 +19,13 @@ package org.springframework.data.couchbase.repository.support; import org.springframework.data.couchbase.core.CouchbaseOperations; import org.springframework.data.couchbase.core.mapping.CouchbasePersistentEntity; import org.springframework.data.couchbase.core.mapping.CouchbasePersistentProperty; -import org.springframework.data.couchbase.core.view.View; import org.springframework.data.couchbase.repository.query.CouchbaseEntityInformation; import org.springframework.data.couchbase.repository.query.CouchbaseQueryMethod; import org.springframework.data.couchbase.repository.query.ViewBasedCouchbaseQuery; import org.springframework.data.mapping.context.MappingContext; import org.springframework.data.mapping.model.MappingException; import org.springframework.data.repository.core.NamedQueries; +import org.springframework.data.repository.core.RepositoryInformation; import org.springframework.data.repository.core.RepositoryMetadata; import org.springframework.data.repository.core.support.RepositoryFactorySupport; import org.springframework.data.repository.query.QueryLookupStrategy; @@ -100,7 +100,7 @@ public class CouchbaseRepositoryFactory extends RepositoryFactorySupport { * @return a new created repository. */ @Override - protected Object getTargetRepository(final RepositoryMetadata metadata) { + protected Object getTargetRepository(final RepositoryInformation metadata) { CouchbaseEntityInformation entityInformation = getEntityInformation(metadata.getDomainType()); final SimpleCouchbaseRepository simpleCouchbaseRepository = new SimpleCouchbaseRepository(entityInformation, couchbaseOperations); simpleCouchbaseRepository.setViewMetadataProvider(viewPostProcessor.getViewMetadataProvider());