3
私はユーレカサーバでもある春の起動アプリケーションを持っています。私はこのユーレカサーバに登録されているすべてのインスタンスをリストしたいと思います。どうすればいいのですか?ユーレカサーバ - 登録されているすべてのインスタンスを一覧表示します
私はユーレカサーバでもある春の起動アプリケーションを持っています。私はこのユーレカサーバに登録されているすべてのインスタンスをリストしたいと思います。どうすればいいのですか?ユーレカサーバ - 登録されているすべてのインスタンスを一覧表示します
registry
は、すべてのApplications
PeerAwareInstanceRegistry registry = EurekaServerContextHolder.getInstance().getServerContext().getRegistry();
Applications applications = registry.getApplications();
applications.getRegisteredApplications().forEach((registeredApplication) -> {
registeredApplication.getInstances().forEach((instance) -> {
System.out.println(instance.getAppName() + " (" + instance.getInstanceId() + ") : " + response);
});
});
を一覧表示する
registry
を使用
EurekaServerContextHolder.getInstance().getServerContext().getRegistry()
を使用して取得