Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that Jersey 1.x version in Eureka is too old?

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you about how to solve the problem that the version of Jersey 1.x in Eureka is too old. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

Spring Cloud is a hot micro-service development framework at present. It has powerful functions, rich components and elegant design. At present, Spring Cloud is still in development.

Spring Cloud is about to release a Spring Cloud Edgware version. This version solves a lot of Bug and adds a lot of new features.

Background

Jersey 1.x is used by default for HTTP protocol-based interaction between Eureka server and client. However, our team needs to use docker-client (https://github.com/docker-java/docker-java). This product only supports Jersey 2.x, while Jersey 1.x is not compatible with 2.x.

Seek a solution

As a result, our team is faced with the following choices:

Use the eureka-client-jersey2 module provided by Eureka, even with Jersey 2.x instead of Jersey 1.x https://github.com/Netflix/eureka/tree/master/eureka-client-jersey2. However, this approach is not secure because eureka-client-jersey2 is provided by the community, is not maintained by the official Eureka team, and has not been updated for a long time.

Abandon docker-client and use other Docker clients, such as https://github.com/spotify/docker-client (this project supports Jersey 1.x and Jersey 2.x).

Upgrade Spring Cloud Netflix to 1.4.x, that is, Spring Cloud Edgware [what I think is the best solution].

This article discusses the details of Eureka in Spring Cloud Edgware.

Jersey of abandoned Eureka Client

In Spring Cloud Edgware, Jersey is not required. Disable Jersey for Eureka Client and use the HTTP client we want, such as RestTemplate. Simply remove the Jersey package from the dependency and Spring Cloud automatically configures a Spring RestTemplate-based transport client. Do the following:

Org.springframework.cloud spring-cloud-starter-eureka com.sun.jersey jersey-client com.sun.jersey jersey-core com.sun.jersey.contribs jersey-apache-client4 income

After a simple operation, there are two benefits:

You don't have to worry about Jersery version conflicts anymore.

Dependence has been reduced a little.

The above is the editor for you to share how to solve the problem of the old version of Jersey 1.x in Eureka, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report