In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the example analysis of Spring Cloud framework selection in Java, which is very detailed and has certain reference value. Friends who are interested must read it!
1. Project structure
The project uses maven as the software package management tool and Spring boot+Spring Cloud as the project infrastructure, with configuration center, service discovery center, gateway center, link tracking center and service cluster, in which link breaker and load balancing mechanism are added between service clusters.
Of course, there are several frameworks that are built according to this logic, so we also refer to this model in general. The details are as follows:
two。 Use of major technical components
Here is a brief introduction to the technical components I choose in practice, there are few reasons for choosing these technologies, to a large extent, taking into account the team preferences and the convenience of follow-up maintenance, as well as the maintenance of the official team.
2.1 Maven
Maven is translated as "expert" and "expert". It is an open source project developed by pure Java under Apache. I mainly use it for package management. Most old developers know that if a project uses a large number of three-party packages, if there is no unified three-party package management, three people may reference four versions of the same package, which is a nightmare for project collaboration. So Maven was born, and since then Javaer has an artifact for package management. Again, maven is not just for package management, it's just a basic idea I use. Of course, there are compilation, batch testing and other functions.
2.2 Spring Boot
Spring Boot is known as a cross-era invention of Spring, and was once considered as a "couldn't be better" technology. Spring Boot solves the problem that the development of a Web website must start a Tomcat or other server to debug; it also solves the need for a large number of xml file configuration before Spring; Spring Boot integrates many common Bean components, and only needs to set the corresponding parameter values in the development process.
Spring Boot created the pom file of Spring Boot maven, which sets up a large number of versions of java tripartite libraries. Depending on a Spring Boot pom file, the corresponding version of java tripartite libraries can be used uniformly.
2.3 Spring Cloud
Spring Cloud, well, I don't know. Spring Cloud can be said to be an ordered collection of frameworks, using Spring Boot to simplify infrastructure development. Spring Cloud is a powerful weapon to implement micro-services. We use Spring Cloud to build service discovery registration, configuration center, message bus, load balancing, circuit breakers and data monitoring.
All in all, this is an amazing project.
2.4 Nacos
Nacos, Alibaba another "KPI" product. At the beginning, many people said that it was another KPI product of Ali. But in fact, Nacos has grown into a strong technical framework in the industry, which integrates service discovery, configuration management and other functions.
The following is the picture I picked from the nacos official, interested friends can take a look.
2.5 Feign service interfacing
Feign, which means "camouflage, metamorphosis" in English, is a HTTP calling framework. It turns the Http call into an interface call without having to write a bunch of code for Http requests. In Spring Cloud, Feign is enhanced so that code for other services can be invoked by defining Interface between services. At the same time, Spring Cloud Feign integrates Ribbon as a load balancing component and Hystrix as a link circuit breaker.
For specific reasons for using load balancing and link circuit breakers, please refer to the Feign configuration section of this series.
2.6 Zipkin
The main reason for using the link tracking system is to track the invocation information between services. After tracking, the calling relationship between services can be confirmed through link information; when errors occur, specific errors can be located through link tracking; and whether the load between services is balanced or not can be confirmed according to the link information. whether the full load is overload and so on.
And Zipkin is the leader in the link tracking system. Zipkin was selected in the project. Let's cheer.
2.7 ElasticSearch
After using link tracing, a large amount of link data is started each time, so you need a database, and ElasticSearch is selected for easy search. So what is ElasticSearch?
Put aside the Elastic Stack on the official website for a while, because I don't know what it says. Simply put, ElasticSearch is a document-based data engine or database. We can realize the full-text search function through ElasticSearch.
2.8 other
The project also integrates Spring Boot Admin and plans to integrate frameworks such as ELK and jwt. However, there are no other requirements for the business for the time being, so no other components have been added for the time being. Any subsequent changes will be updated to the series.
The above is all the contents of the article "sample Analysis of Spring Cloud Framework selection in Java". Thank you for reading! Hope to share the content to help you, more related knowledge, 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.