springboot redis和 jedis版本衝突造成 棧溢出的問題
開發過程中,在springboot項目中引用了 spring-boot-starter-data-redis 。但是之後需要引入其他的系統,導致jedis的jar包衝突,造成了棧溢出,找到問題之後,着手解決問題,解決辦法如下:
1. 使用exclusions移除spring-boot-starter-data-redis 自帶的jedis
2. 移除了之後添加低版本的jedis
<!--springboot redis-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<exclusions>
<exclusion>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--由於xxx不支持太高版本的jedis,
所以要從springboot中移除高版本的jedis,再添加低版本的jedis-->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.4.2</version>
</dependency>
這樣就OK了,結束!