当前位置:网站首页>服务发现@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;
}
边栏推荐
- 深圳堡垒机厂家有哪些?重点推荐哪家?
- LiveData : Transformations.map and Transformations.switchMap usage
- 金仓数据库 KingbaseGIS 使用手册(6.5. 几何对象编辑函数)
- Travel with Shengteng: See all the AI attractions in Jinling City in one day
- Click: 518. Change Exchange II
- tiup cluster stop
- 781. 森林中的兔子
- tiup cluster upgrade
- 70. Stair Climbing Advanced Edition
- tiup cluster template
猜你喜欢

Travel with Shengteng: See all the AI attractions in Jinling City in one day

【集训DAY5】堆箱子【数学】

【JZOF】32从上往下打印二叉树

【C语言】指针和数组的深入理解(第四期)

Live Preview | ICML 2022 11 first-author scholars share online neural network, graph learning and other cutting-edge research

多商户商城系统功能拆解24讲-平台端分销会员

【集训DAY4】矩形【线段树】

Comprehensive analysis of FPGA basics

6款跨境电商常用工具汇总

什么是平面文件数据库? 如何导入多种格式的文件:DSV、JSON、XML?
随机推荐
ES6 从入门到精通 # 12:数组的扩展方法一
tiup cluster upgrade
力扣:322. 零钱兑换
如何知道电脑开机记录?
tiup cluster start
金仓数据库 KingbaseGIS 使用手册(6.3. 几何对象创建函数)
framework源码读后感
How to know the computer boot record?
Snap: 322. Change of Change
Click: 377. Combined Sum Ⅳ
多线程是同时执行多个线程的吗
[JZOF] 82 binary tree with a path of a certain value (1)
【JZOF】32从上往下打印二叉树
JSON对象和字符串相互转化
什么是服务治理
YOLOV5学习笔记(七)——训练自己数据集
6款跨境电商常用工具汇总
Filament-Material 绘制基本图形
干货!迈向鲁棒的测试时间适应
用哈希简单封装unordered_map和unordered_set