SGF-725 - Export composable repositories via CDI.

We now export composable repositories through our CDI extension. Repositories can now be customized either by a single custom implementation (as it was before) and by providing fragment interfaces along their fragment implementation.

This change aligns CDI support with the existing RepositoryFactory support we provide within a Spring application context.
This commit is contained in:
Mark Paluch
2018-03-12 17:02:23 +01:00
parent 11148c1038
commit 1db3c3bc22
4 changed files with 7 additions and 12 deletions

View File

@@ -143,18 +143,11 @@ class GemfireRepositoryBean<T> extends CdiRepositoryBean<T> {
* @param creationalContext operations used by the {@link javax.enterprise.context.spi.Contextual} implementation
* during creation of the bean instance.
* @param repositoryType the actual class type of the SD (GemFire) Repository.
* @param customImplementation the supporting custom Repository implementing class.
* @return a factory used to create instance of {@link org.springframework.data.gemfire.repository.GemfireRepository}.
* @see javax.enterprise.context.spi.Contextual#create(javax.enterprise.context.spi.CreationalContext)
* @see #newGemfireRepositoryFactory()
*/
@Override
@SuppressWarnings("all")
protected T create(CreationalContext<T> creationalContext, Class<T> repositoryType,
Optional<Object> customImplementation) {
return (customImplementation.isPresent()
? newGemfireRepositoryFactory().getRepository(repositoryType, customImplementation.get())
: newGemfireRepositoryFactory().getRepository(repositoryType));
protected T create(CreationalContext<T> creationalContext, Class<T> repositoryType) {
return create(this::newGemfireRepositoryFactory, repositoryType);
}
}