解決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都無問題。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章