LangChain4j整合Redis出现Factory method ‘redisEmbeddingStore‘ threw exception with message: Invalid rule
·
问题
学习Langchain4j过程中,想用Redisearch作为向量数据库,出现了创建Bean异常:
2025-08-22T10:11:43.389+08:00 WARN 15268 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'commonConfig': Unsatisfied dependency expressed through field 'redisEmbeddingStore': Error creating bean with name 'redisEmbeddingStore' defined in class path resource [dev/langchain4j/community/store/embedding/redis/spring/RedisEmbeddingStoreAutoConfiguration.class]: Failed to instantiate [dev.langchain4j.community.store.embedding.redis.RedisEmbeddingStore]: Factory method 'redisEmbeddingStore' threw exception with message: Invalid rule type
2025-08-22T10:11:43.398+08:00 INFO 15268 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2025-08-22T10:11:43.405+08:00 INFO 15268 --- [ main] .s.b.a.l.ConditionEvaluationReportLogger :
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2025-08-22T10:11:43.431+08:00 ERROR 15268 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'commonConfig': Unsatisfied dependency expressed through field 'redisEmbeddingStore': Error creating bean with name 'redisEmbeddingStore' defined in class path resource [dev/langchain4j/community/store/embedding/redis/spring/RedisEmbeddingStoreAutoConfiguration.class]: Failed to instantiate [dev.langchain4j.community.store.embedding.redis.RedisEmbeddingStore]: Factory method 'redisEmbeddingStore' threw exception with message: Invalid rule type
问题分析
redis-search版本和LangChain4j版本不匹配,当换上2.4.9的search版本时,SpringBoot能正确创建Bean注入容器,并实现Redis存储向量。
# 安装redisearch的docker命令
docker run -d --name redis-vector -p 6379:6379 redislabs/redisearch:2.4.9

总结
需要注意版本兼容性问题
更多推荐
所有评论(0)