解决spring-data-elasticsearch的netty包冲突

netty4.0后,不再是jboss的一部分,包名从 org.jboss.netty 变更为 io.netty

jar包也被分割成了多个子模块,以便用户可以定制引入需要的子包。当前结构如下:

Artifact ID Description
netty-parent Maven parent POM
netty-common Utility classes and logging facade
netty-buffer ByteBuf API that replaces java.nio.ByteBuffer
netty-transport Channel API and core transports
netty-transport-rxtx Rxtx transport
netty-transport-sctp SCTP transport
netty-transport-udt UDT transport
netty-handler Useful ChannelHandler implementations
netty-codec Codec framework that helps write an encoder and a decoder
netty-codec-http Codecs related with HTTP, Web Sockets, SPDY, and RTSP
netty-codec-socks Codecs related with SOCKS protocol
netty-all All-in-one JAR that combines all artifacts above
netty-tarball Tarball distribution
netty-example Examples
netty-testsuite-* A collection of integration tests
netty-microbench Microbenchmarks

注意:会有一个全包,netty-all

spring-data-elasticsearc3.1.14引用的是netty4的部分子包,而我们的微服务框架引用的是netty-all4.0.3.Final包,这样就产生了冲突,你可能会想,排除spring-data-elasticsearc的所有子包,但是spring-data-elasticsearc使用的netty的版本是4.1.13.Final,比较新的版本,有些方法,在netty-all4.0.3.Final中没有,所以这种方案pass掉,那么可以这样,引用高版本的netty,排除掉子包(单个/所有皆可),一般高版本会兼容低版本的方法,统一使用netty-all4.1.13.Final版本的包,微服务和spring-data-elasticsearc3.1.14都无问题。

发布了19 篇原创文章 · 获赞 16 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/matt8/article/details/105058768
今日推荐