今天在使用spring学习redis的时候疯狂遇到这两种异常NoClassDefFoundError和BeanCreationException
NoClassDefFoundError是这种形式
NoClassDefFoundError:org/springframework/data/geo/Metric
BeanCreationException 是这种形式
而这两种错误的主要原因是因为jedis和spring-data-redis不匹配
这里有几种配置途径
jedis | spring-data-redis | jdk |
---|---|---|
2.8.1 | 1.7.2.RELEASE | 1.8 |
2.4.2 | 1.5.2.RELEASE | 1.8 |
2.7.3 | 1.5.2.RELEAS | 1.8 |
2.9.0 | 1.8.1.RELEASE | 1.8 |
2.9.0 | 2.1.6.RELEASE | 1.8 |
2.9.0 | 2.1.8.RELEASE | 1.8 |
2.9.3 | 2.1.8.RELEASE | 1.8 |
2.10.1 | 2.1.8.RELEASE | 1.8 |
而我使用了jedis 2.9.0 和spring-data-redis2.1.8.RELEASE 的解决方法
这是他们的maven依赖
<!-- https://mvnrepository.com/artifact/redis.clients/jedis
https:/