项目依赖jetcache-starter-redis从2.5.15升级到2.6.0项目启动报错循环依赖
- Dominant language
- Java
- Stars
- 5.6k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
升级前项目依赖如下:
springboot保持不变
spring-boot-starter-parent
2.2.5.RELEASE
jetcache-starter-redis
升级前
jetcache-starter-redis
2.5.15
指定jedis为低版本
jedis
2.9.0
升级后
jetcache-starter-redis
2.6.0
并去掉jedis的指定版本
启动项目后报错提示循环依赖:
WARN 2021-10-12 15:34:08.140 16504 AbstractApplicationContext.java:558 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'indexShiroConfiguration': Unsatisfied dependency expressed through field 'resourceService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceServiceImpl': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'globalCacheConfig' defined in class path resource [com/alicp/jetcache/autoconfigure/JetCacheAutoConfiguration.class]: Circular depends-on relationship between 'globalCacheConfig' and 'com.alicp.jetcache.autoconfigure.LinkedHashMapAutoConfiguration'
尝试过再启动类上加上包扫描
@ComponentScan(basePackages = {"com.alicp.jetcache.autoconfigure","xx自己的业务包名xx"})
启动依然包循环依赖,只是依赖的bean换了
WARN 2021-10-12 15:40:44.194 17116 AbstractApplicationContext.java:558 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'indexShiroConfiguration': Unsatisfied dependency expressed through field 'resourceService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceServiceImpl': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'globalCacheConfig' defined in class path resource [com/alicp/jetcache/autoconfigure/JetCacheAutoConfiguration.class]: Circular depends-on relationship between 'globalCacheConfig' and 'redisAutoInit'
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Maven dependency change from jetcache-starter-redis 2.5.15 to 2.6.0 and the startup exception. Inspect JetCacheAutoConfiguration, globalCacheConfig, LinkedHashMapAutoConfiguration, and redisAutoInit, then reproduce the application startup with and without the explicit jedis 2.9.0 dependency. Done means the project starts without a circular depends-on relationship.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, redis, spring
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100