11/*
2- * Copyright 2015 the original author or authors.
2+ * Copyright 2015-2016 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
4242 * {@link org.springframework.data.keyvalue.repository.KeyValueRepository}.
4343 *
4444 * @author Christoph Strobl
45+ * @author Oliver Gierke
4546 * @since 1.7
4647 */
4748public class RedisRepositoryFactory extends KeyValueRepositoryFactory {
4849
50+ private final KeyValueOperations operations ;
51+ private final Class <? extends AbstractQueryCreator <?, ?>> queryCreator ;
52+
4953/**
5054 * @param keyValueOperations
5155 * @see KeyValueRepositoryFactory#KeyValueRepositoryFactory(KeyValueOperations)
5256 */
5357public RedisRepositoryFactory (KeyValueOperations keyValueOperations ) {
54- super (keyValueOperations );
58+ this (keyValueOperations , DEFAULT_QUERY_CREATOR );
5559}
5660
5761/**
@@ -62,6 +66,9 @@ public RedisRepositoryFactory(KeyValueOperations keyValueOperations) {
6266public RedisRepositoryFactory (KeyValueOperations keyValueOperations ,
6367Class <? extends AbstractQueryCreator <?, ?>> queryCreator ) {
6468super (keyValueOperations , queryCreator );
69+
70+ this .operations = keyValueOperations ;
71+ this .queryCreator = queryCreator ;
6572}
6673
6774/*
@@ -70,7 +77,7 @@ public RedisRepositoryFactory(KeyValueOperations keyValueOperations,
7077 */
7178@ Override
7279protected QueryLookupStrategy getQueryLookupStrategy (Key key , EvaluationContextProvider evaluationContextProvider ) {
73- return new RedisQueryLookupStrategy (key , evaluationContextProvider , getKeyValueOperations (), getQueryCreator () );
80+ return new RedisQueryLookupStrategy (key , evaluationContextProvider , operations , queryCreator );
7481}
7582
7683/*
@@ -81,7 +88,8 @@ protected QueryLookupStrategy getQueryLookupStrategy(Key key, EvaluationContextP
8188@ SuppressWarnings ("unchecked" )
8289public <T , ID extends Serializable > EntityInformation <T , ID > getEntityInformation (Class <T > domainClass ) {
8390
84- RedisPersistentEntity <T > entity = (RedisPersistentEntity <T >) getMappingContext ().getPersistentEntity (domainClass );
91+ RedisPersistentEntity <T > entity = (RedisPersistentEntity <T >) operations .getMappingContext ()
92+ .getPersistentEntity (domainClass );
8593EntityInformation <T , ID > entityInformation = (EntityInformation <T , ID >) new MappingRedisEntityInformation <T , ID >(
8694entity );
8795
0 commit comments