当前位置:网站首页>服务发现@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;
}
边栏推荐
- Force Buckle: 474. Ones and zeros
- Live Preview | ICML 2022 11 first-author scholars share online neural network, graph learning and other cutting-edge research
- 全面解析FPGA基础知识
- 测试2年,当时身边一起入行的朋友已经月薪20k了,自己还没过万,到底差在了哪里?
- 【集训DAY4】矩形【线段树】
- tiup cluster upgrade
- JS基础笔记-关于对象
- 用函数统计最长单词的字母数量
- 2022年最新《谷粒学院开发教程》:10 - 前台支付模块
- 2022/8/9 考试总结
猜你喜欢
How to know the computer boot record?
[Interface Test] Decoding the request body string of the requests library
AUTOCAD——形位公差如何标注、CAD打断于点的操作
2022-08-09 mysql/stonedb-子查询性能提升-概论
Has your phone ever been monitored?
位图的基本原理以及应用
【SSL集训DAY2】Sort【树状数组】
多商户商城系统功能拆解25讲-平台端分销申请
深入理解多线程(第一篇)
数字钱包红海角逐,小程序生态快速引入可助力占领智慧设备入口
随机推荐
Gartner's global integrated system market data tracking, hyperconverged market growth rate is the first
complete knapsack theory
CAD 绘制圆角处理
防火墙之系统防护
多线程是同时执行多个线程的吗
ES6 从入门到精通 # 13:数组的扩展方法二
JS基础笔记-关于对象
国内BI厂商一览
[JZOF] 82 binary tree with a path of a certain value (1)
Sqlserver restricts the ip under which accounts can access the database
了解什么是架构基本概念和架构本质
Force Buckle: 474. Ones and zeros
H5实现分享功能
68. qt quick-qml multi-level folding drop-down navigation menu supports dynamic add/unload, support qml/widget loading, etc.
力扣:279.完全平方数
恭喜获奖得主 | 互动有礼获赠 Navicat Premium
数字钱包红海角逐,小程序生态快速引入可助力占领智慧设备入口
ES6 从入门到精通 # 12:数组的扩展方法一
A Shanghai technology company was fined 220,000 for brushing orders, exposing the gray industry chain of online brushing
直播app开发搭建,flutter 实现自适应、自动换行、相对布局