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,.
This commit is contained in:
A.J. Brown
2015-05-15 16:06:59 -04:00
committed by Michael Nitschinger
parent d66cbed6f7
commit 572e48b4b6
2 changed files with 10 additions and 2 deletions

View File

@@ -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

View File

@@ -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<?, Serializable> entityInformation = getEntityInformation(metadata.getDomainType());
final SimpleCouchbaseRepository simpleCouchbaseRepository = new SimpleCouchbaseRepository(entityInformation, couchbaseOperations);
simpleCouchbaseRepository.setViewMetadataProvider(viewPostProcessor.getViewMetadataProvider());