当前位置:网站首页>服务发现@EnableDiscoveryClient
服务发现@EnableDiscoveryClient
2022-08-09 22:46:00 【一个风轻云淡】
@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient //服务发现
public class PaymentMain8001
{
public static void main(String[] args)
{
SpringApplication.run(PaymentMain8001.class,args);
}
}
@Resource
private DiscoveryClient discoveryClient;
@GetMapping(value = "/payment/discovery")
public Object discovery()
{
List<String> services = discoveryClient.getServices();
for (String element : services) {
System.out.println(element);
}
List<ServiceInstance> instances = discoveryClient.getInstances("CLOUD-PAYMENT-SERVICE");
for (ServiceInstance element : instances) {
System.out.println(element.getServiceId() + "\t" + element.getHost() + "\t" + element.getPort() + "\t"
+ element.getUri());
}
return this.discoveryClient;
}
边栏推荐
- 金仓数据库 KingbaseGIS 使用手册(6.5. 几何对象编辑函数)
- 分布式数据库难题(三):数据一致性
- Has your phone ever been monitored?
- tiup cluster upgrade
- CAD 截断线段
- 中国SaaS企业排名,龙头企业Top10梳理
- Force Buckle: 474. Ones and zeros
- LiveData : Transformations.map and Transformations.switchMap usage
- How to know the computer boot record?
- Click: 518. Change Exchange II
猜你喜欢
随机推荐
H5实现分享功能
【JZOF】82二叉树中和为某一值的路径(一)
harbor配置远程仓库
分布式数据库难题(二):数据复制
70. 爬楼梯进阶版
MVC与MVVM模式的区别
Technology feast!Huayun Data brings six topics to OpenInfra Days China
[JZOF] 82 binary tree with a path of a certain value (1)
【SSL集训DAY3】控制棋盘【二分图匹配】
A summary of 6 common tools for cross-border e-commerce
【诗歌】最高级的惩罚就是沉默
tiup cluster stop
用函数统计最长单词的字母数量
技术盛宴!华云数据携六大议题亮相OpenInfra Days China
力扣:377. 组合总和 Ⅳ
【接口测试】requests 库请求体字符串解码
【诗歌】被讨厌的勇气
[Cloud Native] This article explains how to add Tencent Crane to Kubevela addon
LeetCode952三部曲之三:再次优化(122ms -> 96ms,超51% -> 超91%)
【实用工具系列】MathCAD入门安装及快速上手使用教程