diff --git a/build.gradle b/build.gradle index 503cf758..483678b7 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ description = 'Spring Data GemFire' group = 'org.springframework.data' repositories { - maven { url "http://repo.springsource.org/libs-milestone" } + maven { url "http://repo.springsource.org/libs-snapshot" } maven { url "http://repo.springsource.org/plugins-release"} maven { url "http://dist.gemstone.com.s3.amazonaws.com/maven/release"} } diff --git a/gradle.properties b/gradle.properties index 30eafcd4..91b1bf10 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ slf4jVersion = 1.6.4 # Common libraries springVersion = 3.2.0.RC1 -springDataCommonsVersion = 1.4.0.RELEASE +springDataCommonsVersion = 1.5.0.BUILD-SNAPSHOT gemfireVersion = 7.0 # Testing diff --git a/src/main/java/org/springframework/data/gemfire/repository/config/GemfireRepositoryConfigurationExtension.java b/src/main/java/org/springframework/data/gemfire/repository/config/GemfireRepositoryConfigurationExtension.java index 8b35a19b..a1271fd1 100644 --- a/src/main/java/org/springframework/data/gemfire/repository/config/GemfireRepositoryConfigurationExtension.java +++ b/src/main/java/org/springframework/data/gemfire/repository/config/GemfireRepositoryConfigurationExtension.java @@ -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); } } -} \ No newline at end of file +} diff --git a/src/main/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryBean.java b/src/main/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryBean.java index 367f93e0..3fba3505 100644 --- a/src/main/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryBean.java +++ b/src/main/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryBean.java @@ -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, S, ID ext * * @param context the context to set */ - public void setMappingContext( + public void setGemfireMappingContext( MappingContext, GemfirePersistentProperty> context) { this.context = context; } @@ -79,4 +80,19 @@ public class GemfireRepositoryFactoryBean, 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(); + } } diff --git a/src/test/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryIntegrationTests.java b/src/test/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryIntegrationTests.java index 2ae9edaf..e1e5fa60 100644 --- a/src/test/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryIntegrationTests.java +++ b/src/test/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryIntegrationTests.java @@ -15,11 +15,19 @@ */ package org.springframework.data.gemfire.repository.support; +import static org.hamcrest.CoreMatchers.*; +import static org.junit.Assert.*; + import java.util.Collections; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; import org.springframework.data.gemfire.mapping.Regions; +import org.springframework.data.gemfire.repository.sample.Person; import org.springframework.data.gemfire.repository.sample.PersonRepository; +import org.springframework.data.mapping.PersistentEntity; +import org.springframework.data.repository.support.Repositories; import org.springframework.test.context.ContextConfiguration; /** @@ -30,6 +38,9 @@ import org.springframework.test.context.ContextConfiguration; @ContextConfiguration("../config/repo-context.xml") public class GemfireRepositoryFactoryIntegrationTests extends AbstractGemfireRepositoryFactoryIntegrationTests { + @Autowired + ApplicationContext context; + @Override protected PersonRepository getRepository(Regions regions) { @@ -44,4 +55,15 @@ public class GemfireRepositoryFactoryIntegrationTests extends AbstractGemfireRep GemfireRepositoryFactory factory = new GemfireRepositoryFactory((Iterable) Collections.emptySet(), null); factory.getRepository(PersonRepository.class); } + + /** + * @see SGF-140 + */ + @Test + public void exposesPersistentProperty() { + + Repositories repositories = new Repositories(context); + PersistentEntity entity = repositories.getPersistentEntity(Person.class); + assertThat(entity, is(notNullValue())); + } }