java.lang.IllegalStateException: Failed to load ApplicationContext
来源:11-5 引入缓存技术之编码实现上
闻溪
2022-12-05
老师好,我用的IDEA,测试的时候报这个错误👇
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘shopListController’: Unsatisfied dependency expressed through field ‘areaService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘areaServiceImpl’: Unsatisfied dependency expressed through field ‘jedisKeys’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘jedisKeys’ defined in class path resource [spring/spring-redis.xml]: Cannot resolve reference to bean ‘jedisUtil’ while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘jedisUtil’ defined in class path resource [spring/spring-redis.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property ‘jedisPool’ of bean class [com.jun.shopping.cache.JedisUtil]: Bean property ‘jedisPool’ is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
我的spring-redis.xml是这样配置的
<!-- 创建Redis工具类,封装好Redis的连接以进行相关的操作 -->
<bean id="jedisUtil" class="com.jun.shopping.cache.JedisUtil"
scope="singleton">
<property name="jedisPool" ref="jedisWritePool"/>
</bean>
<!-- Redis的key操作 -->
<bean id="jedisKeys" class="com.jun.shopping.cache.JedisUtil$Keys"
scope="singleton">
</bean>
<!-- Redis的Strings操作 -->
<bean id="jedisStrings" class="com.jun.shopping.cache.JedisUtil$Strings"
scope="singleton">
希望老师可以帮忙指点一下,这是哪里出错了,谢谢~
1回答
-
闻溪
提问者
2022-12-05
已解决,这么写就能用,但也不是很懂为啥
012022-12-06
相似问题