SpringBoot Admin - 如何防止 SpringBoot Admin Server 注册自己?

问题描述

关于 Spring Boot Admin (SBA) 的小问题。

我可以很好地将客户端注册到 SBA 服务器,非常高兴。 不幸的是,服务器本身向自己注册。

SBA 的用途是监控和获取有关 SBA 客户端的信息。 我很难让 SBA 服务器不注册自己,而只是接受来自客户端的注册。

请问实现此目标的最佳方法是什么?

在我的应用中,我有:

@EnableScheduling
@EnableAdminServer
@EnableDiscoveryClient
@SpringBootApplication
public class MyApplication {

谢谢

解决方法

在您的管理服务器属性中,您可以使用 spring.boot.admin.discovery.services 属性专门将您想要监控的应用程序列入白名单,或者您可以使用 spring.boot.admin.discovery.ignored-services 属性将您不想要的任何应用程序列入黑名单进行监控。

就您而言,您可以:

spring.boot.admin.discovery.ignored-services:
  - 'admin-server'

其中 admin-server 是您的管理服务器的 spring.application.name

结帐Table 4. Discovery configuration options

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...