Parameter 0 of method setFunctionDomainRedisTemplate in XXX required a single bean, but 2 were found

在项目中遇到一个错误,方法 setFunctionDomainRedisTemplate 在 com.uhope.hzz.util.RedisOperateUtil 需要一个单一的 bean,但找到2个:redisTemplate 和 stringRedisTemplate。问题源于 Spring Boot 的自动配置,由于存在两个 redisConnectionFactory 导致。解决方案是通过 @Primary 或 @Qualifier 注解明确指定使用哪个 bean,或者调整项目依赖避免冲突。
摘要由CSDN通过智能技术生成

1. 问题描述

Parameter 0 of method setFunctionDomainRedisTemplate in com.uhope.hzz.util.RedisOperateUtil required a single bean, but 2 were found:

  • redisTemplate: defined by method ‘redisTemplate’ in class path resource [org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration R e d i s C o n f i g u r a t i o n . c l a s s ] − s t r i n g R e d i s T e m p l a t e : d e f i n e d b y m e t h o d ′ s t r i n g R e d i s T e m p l a t e ′ i n c l a s s p a t h r e s o u r c e [ o r g / s p r i n g f r a m e w o r k / b o o t / a u t o c o n f i g u r e / d a t a / r e d i s / R e d i s A u t o C o n f i g u r a t i o n RedisConfiguration.class] - stringRedisTemplate: defined by method 'stringRedisTemplate' in class path resource [org/springframework/boot/autoconfigure/data/redis/RedisAutoConfiguration RedisConfigurati
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值