SGF-403 - Simplify the process of adding custom methods to Spring Data GemFire Repositories.
This commit is contained in:
@@ -27,6 +27,7 @@ import org.springframework.context.annotation.ComponentScan.Filter;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.data.gemfire.mapping.GemfireMappingContext;
|
||||
import org.springframework.data.gemfire.repository.support.GemfireRepositoryFactoryBean;
|
||||
import org.springframework.data.repository.config.DefaultRepositoryBaseClass;
|
||||
import org.springframework.data.repository.query.QueryLookupStrategy;
|
||||
import org.springframework.data.repository.query.QueryLookupStrategy.Key;
|
||||
|
||||
@@ -119,6 +120,13 @@ public @interface EnableGemfireRepositories {
|
||||
*/
|
||||
Class<?> repositoryFactoryBeanClass() default GemfireRepositoryFactoryBean.class;
|
||||
|
||||
/**
|
||||
* Configure the repository base class to be used to create repository proxies for this particular configuration.
|
||||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
Class<?> repositoryBaseClass() default DefaultRepositoryBaseClass.class;
|
||||
|
||||
/**
|
||||
* Configures the name of the {@link GemfireMappingContext} bean definition to be used to create repositories
|
||||
* discovered through this annotation. If not configured a default one will be created.
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.data.gemfire.repository.query.PartTreeGemfireReposito
|
||||
import org.springframework.data.gemfire.repository.query.StringBasedGemfireRepositoryQuery;
|
||||
import org.springframework.data.mapping.context.MappingContext;
|
||||
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;
|
||||
@@ -88,10 +89,13 @@ public class GemfireRepositoryFactory extends RepositoryFactorySupport {
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
protected Object getTargetRepository(RepositoryMetadata metadata) {
|
||||
GemfireEntityInformation<?, Serializable> entityInformation = getEntityInformation(metadata.getDomainType());
|
||||
GemfireTemplate gemfireTemplate = getTemplate(metadata);
|
||||
return new SimpleGemfireRepository(gemfireTemplate, entityInformation);
|
||||
protected Object getTargetRepository(RepositoryInformation repositoryInformation) {
|
||||
GemfireEntityInformation<?, Serializable> entityInformation = getEntityInformation(
|
||||
repositoryInformation.getDomainType());
|
||||
|
||||
GemfireTemplate gemfireTemplate = getTemplate(repositoryInformation);
|
||||
|
||||
return getTargetRepositoryViaReflection(repositoryInformation, gemfireTemplate, entityInformation);
|
||||
}
|
||||
|
||||
private GemfireTemplate getTemplate(RepositoryMetadata metadata) {
|
||||
@@ -139,7 +143,7 @@ public class GemfireRepositoryFactory extends RepositoryFactorySupport {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see springframework.data.repository.core.support.RepositoryFactorySupport
|
||||
* #getQueryLookupStrategy(org.springframework.data.repository.query.QueryLookupStrategy.Key)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user