SGF-140 - Update to Spring Data Commons 1.5.0.

Expose GemfireMappingContext to the parent class to enable PersistentEntity lookup.
This commit is contained in:
Oliver Gierke
2012-11-28 19:01:25 +01:00
parent 0a2fcb7324
commit b9f4a55c79
5 changed files with 43 additions and 5 deletions

View File

@@ -74,7 +74,7 @@ public class GemfireRepositoryConfigurationExtension extends RepositoryConfigura
String mappingContextRef = element.getAttribute(MAPPING_CONTEXT_REF);
if (StringUtils.hasText(mappingContextRef)) {
builder.addPropertyReference("mappingContext", mappingContextRef);
builder.addPropertyReference("gemfireMappingContext", mappingContextRef);
}
}
}
}

View File

@@ -23,6 +23,7 @@ import org.springframework.beans.BeansException;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.data.gemfire.mapping.GemfireMappingContext;
import org.springframework.data.gemfire.mapping.GemfirePersistentEntity;
import org.springframework.data.gemfire.mapping.GemfirePersistentProperty;
import org.springframework.data.mapping.context.MappingContext;
@@ -63,7 +64,7 @@ public class GemfireRepositoryFactoryBean<T extends Repository<S, ID>, S, ID ext
*
* @param context the context to set
*/
public void setMappingContext(
public void setGemfireMappingContext(
MappingContext<? extends GemfirePersistentEntity<?>, GemfirePersistentProperty> context) {
this.context = context;
}
@@ -79,4 +80,19 @@ public class GemfireRepositoryFactoryBean<T extends Repository<S, ID>, S, ID ext
protected RepositoryFactorySupport createRepositoryFactory() {
return new GemfireRepositoryFactory(regions, context);
}
/*
* (non-Javadoc)
* @see org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport#afterPropertiesSet()
*/
@Override
public void afterPropertiesSet() {
if (this.context == null) {
this.context = new GemfireMappingContext();
setMappingContext(context);
}
super.afterPropertiesSet();
}
}