报错内容是:
Error creating bean with name 'redissonClient': Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.redisson.api.RedissonClient]: Factory method 'create' threw exception; nested exception is java.lang.NoSuchMethodError: io.netty.channel.nio.NioEventLoopGroup.<init>(ILjava/util/concurrent/ThreadFactory;)
使用的redisson版本是3.10.7
查看maven的依赖树方法:
mvn dependency:tree
然后搜索netty。查看netty的具体版本。
最后通过调试源码发现,我用的netty版本过高,然后经过几番测试,使用了netty 4.1.36.
目前redisson不支持netty5,同时3.10.7版本的redisson,不支持部分 netty4.0.x版本,所以使用redisson时需要注意了。
然后更换maven的版本。