我们有Spring Boot Admin版本-2.0.3和相应的客户端版本。
我们的spring boot实例被部署到Pivotal Cloud Foundry。
在我们部署一个新版本的spring引导实例之前,一切都运行得很好。将为实例生成一个新的内部url,并将其注册到管理员。但是它没有从管理员那里注销已删除的实例。
因此,它使spring boot管理处于不一致的状态。例如:

如何让已注册的实例在被销毁时注销它自己。
我已经尝试设置:
spring.boot.admin.client.auto-deregistration = true但它并没有像预期的那样工作。
发布于 2019-09-13 03:10:32
设置auto-deregistration=true会使客户端应用程序向终结点/instances/{id}上的服务器发送http delete调用。还必须在服务器上禁用此端点的Csrf检查。spring启动管理文档中的示例securityconfiguration中缺少此配置。(参见https://github.com/codecentric/spring-boot-admin/issues/1251 )
要修复此问题,请替换
.csrf()
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.ignoringAntMatchers(adminContextPath + "/instances", adminContextPath + "/actuator/**");使用
.csrf()
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.ignoringRequestMatchers(
new AntPathRequestMatcher(adminContextPath + "/instances", HttpMethod.POST.toString()),
new AntPathRequestMatcher(adminContextPath + "/instances/*", HttpMethod.DELETE.toString()),
new AntPathRequestMatcher(adminContextPath + "/actuator/**")
);https://stackoverflow.com/questions/55699949
复制相似问题