Skip to content

Commit

Permalink
Use field autowiring in RedisEnhancedRepositoryFactoryBean
Browse files Browse the repository at this point in the history
  • Loading branch information
sumitjainn authored and bsbodden committed Aug 24, 2024
1 parent b186349 commit 8b4ab3d
Showing 1 changed file with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.redis.om.spring.ops.RedisModulesOperations;
import com.redis.om.spring.repository.query.RedisEnhancedQuery;
import com.redis.om.spring.vectorize.Embedder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.keyvalue.core.KeyValueOperations;
import org.springframework.data.keyvalue.repository.config.QueryCreatorType;
import org.springframework.data.mapping.context.MappingContext;
Expand All @@ -21,38 +22,30 @@
public class RedisEnhancedRepositoryFactoryBean<T extends Repository<S, ID>, S, ID>
extends RepositoryFactoryBeanSupport<T, S, ID> {

private @Nullable KeyValueOperations operations;
@Autowired
private @Nullable RedisModulesOperations<String> rmo;
@Autowired
private @Nullable RedisOperations<?, ?> redisOperations;
@Autowired
private @Nullable RediSearchIndexer indexer;
private @Nullable Class<? extends AbstractQueryCreator<?, ?>> queryCreator;
private @Nullable Class<? extends RepositoryQuery> repositoryQueryType;
@Autowired
private @Nullable Embedder embedder;

@Autowired
private RedisOMProperties properties;

private @Nullable KeyValueOperations operations;
private @Nullable Class<? extends AbstractQueryCreator<?, ?>> queryCreator;
private @Nullable Class<? extends RepositoryQuery> repositoryQueryType;

/**
* Creates a new {@link RedisRepositoryFactoryBean} for the given repository
* interface.
*
* @param repositoryInterface must not be {@literal null}.
* @param redisOperations must not be {@literal null}.
* @param rmo must not be {@literal null}.
* @param indexer must not be {@literal null}.
*/
public RedisEnhancedRepositoryFactoryBean( //
Class<? extends T> repositoryInterface, //
RedisOperations<?, ?> redisOperations, //
RedisModulesOperations<?> rmo, //
RediSearchIndexer indexer, //
Embedder embedder, //
RedisOMProperties properties) {
Class<? extends T> repositoryInterface) {
super(repositoryInterface);
setRedisModulesOperations(rmo);
setRedisOperations(redisOperations);
setKeyspaceToIndexMap(indexer);
setFeatureExtractor(embedder);
setRedisOMSpringProperties(properties);
}

private void setFeatureExtractor(Embedder embedder) {
Expand Down

0 comments on commit 8b4ab3d

Please sign in to comment.