当前位置:网站首页>@loadbalance annotation of resttemplate
@loadbalance annotation of resttemplate
2022-06-12 21:21:00 【GodSure0914】
In the use of springcloud ribbon When the client load is balanced , You can give RestTemplate bean Add one more @LoadBalanced annotation , You can make this RestTemplate The ability to load balance the client on request :
/** * Injection is used to call the third-party interface RestTemplate * @return RestTemplate */
@Bean
@LoadBalanced
public RestTemplate loadBalancedRestTemplate() {
// Pass... For the time being build obtain new Coming out sMessageConverters Lack of parameter
RestTemplate buildTemplate = restTemplateBuilder.build();
buildTemplate.setRequestFactory(httpRequestFactory());
return buildTemplate;
}
1 If a service is clustered, it may not be able to find a service for me to run without this annotation. Therefore, this annotation must be added to make my service request have the ability of client load balancing , So that we don't make a mistake
2. Here I want to state that the default load balancing mechanism is that polling is a round robin service
3. First : This @LoadBalanced Annotations are from cloud A comment under the package
4. This annotation is to make something have the ability of load balancing
Through the source code of annotations, it is found that there are only more than ordinary annotations @Qualifier:
This annotation is used for precise injection by name .
When spring There are multiple of the same type in the container bean When , Can pass @Qualifier To distinguish , So that when you inject, you can clearly indicate which specific... You want to inject bean, disambiguate .
边栏推荐
- Integrated monitoring solution for power environment of small and medium-sized computer rooms
- #113 Path Sum II
- Introduction to the characteristics of balancer decentralized exchange market capitalization robot
- China hydraulic cylinder linear position sensor market trend report, technical dynamic innovation and market forecast
- Teambition 协作应用心得分享|社区征文
- Large and small end conversion
- Structure knowledge points all in
- InRelease: 由于没有公钥,无法验证下列签名: NO_PUBKEY EB3E94ADBE1229CF
- 同花顺能开户吗,同花顺在APP上可以直接开通券商安全吗 ,买股票怎么网上开户
- What are the disadvantages of bone conduction earphones? Analysis of advantages and disadvantages of bone conduction earphones
猜你喜欢
结构体知识点all in
Vs2017 environmental issues
Image processing 12- image linear blending
Li Mu [practical machine learning] 1.4 data annotation
Data visualization diagram microblog forwarding diagram
Shell language
Scope and scope chain
Teamwork collaboration application experience sharing | community essay solicitation
It has been engaged in the functional test of 10K to the test development of 40W annual salary for 5 years, and spent 7 days sorting out the super comprehensive learning route
Composer version degradation
随机推荐
竣达技术丨适用于“科士达”智能精密空调网络监控
zgc的垃圾收集的主要阶段
remote: Support for password authentication was removed on August 13, 2021
Preliminary understanding of regular expressions (regex)
Binary search
Research Report on market supply and demand and strategy of hydraulic operating table industry in China
leetcode:207. Class Schedule Card
How to improve communication efficiency during home office | community essay solicitation
GNS installation and configuration
Lombok package is successfully installed, but the runtime prompts that get, set method and constructor solution cannot be found
Access control system based on RFID
Large and small end conversion
New product release Junda intelligent integrated environmental monitoring terminal
My way of programming
InRelease: 由于没有公钥,无法验证下列签名: NO_PUBKEY EB3E94ADBE1229CF
The service did not report any errors MySQL
#141 Linked List Cycle
同花顺能开户吗,同花顺在APP上可以直接开通券商安全吗 ,买股票怎么网上开户
Vs2017 environmental issues
同花顺能开户吗,在同花顺开户安全么