简体   繁体   English

如何启用执行器中的所有端点(Spring Boot 2.0.0 RC1)

[英]How to enable all endpoints in actuator (Spring Boot 2.0.0 RC1)

I moved to Spring Boot 2.0.0 RC1 from 1.5.10 and I am stuck with actuator in the latest version. 我从1.5.10移动到Spring Boot 2.0.0 RC1,我在最新版本中遇到了执行器。 How can I enable expose and enable all actuator endpoints? 如何启用公开并启用所有执行器端点?

The only endpoints that get exposed are: 暴露的唯一端点是:

{
  "_links": {
    "self": {
      "href": "http://127.0.0.1:8080/actuator",
      "templated": false
    },
    "health": {
      "href": "http://127.0.0.1:8080/actuator/health",
      "templated": false
    },
    "info": {
      "href": "http://127.0.0.1:8080/actuator/info",
      "templated": false
    }
  }
}

This is my application.properties files. 这是我的application.properties文件。 Any ideas? 有任何想法吗?

#The three first ones seem to be obsolete
endpoints.configprops.enabled=true
endpoints.beans.enabled=true
endpoints.shutdown.enabled=true

management.endpoints.enabled-by-default=true
management.endpoints.sensitive=false
management.endpoints.enabled=true

management.endpoint.configprops.enabled=true
management.endpoint.beans.enabled=true
management.endpoint.shutdown.enabled=true

management.endpoints.web.exposure.include=*

With Spring Boot 2.0.0.RC1, actuator endpoints must be 1) enabled and 2) exposed. 使用Spring Boot 2.0.0.RC1,执行器端点必须1)启用并且2)暴露。

By default, all endpoints but shutdown are enabled and only health and info are exposed. 默认情况下,启用所有端点但shutdown ,仅显示healthinfo

In your case, the following should work: 在您的情况下,以下应该工作:

management.endpoints.web.expose=*
# if you'd like to expose shutdown:
# management.endpoint.shutdown.enabled=true

Note that this changes (again!) as of Spring Boot 2.0.0.RC2: 请注意,从Spring Boot 2.0.0.RC2开始,这会再次发生变化(再次!):

management.endpoints.web.exposure.include=*
# if you'd like to expose shutdown:
# management.endpoint.shutdown.enabled=true

In doubt, the dedicated migration guide is always up-to-date with the latest changes. 毫无疑问, 专用的迁移指南始终与最新的更改保持同步。

Edit 编辑

For easy copy and paste, here's the `yaml´ versions - as of Spring Boot 2.0.0.RC2: 为了便于复制和粘贴,这里是`yaml'版本 - 从Spring Boot 2.0.0开始.RC2:

management:
  endpoints:
    web:
      exposure:
        include: "*"

before: 之前:

management:
  endpoints:
    web:
      expose: "*"

I will add that for Spring Boot 2 the actuator security has been changed (for 1.X the security for actuator has separate configuration what often cause problems when it mixes with user configuration). 我将补充一点,对于Spring Boot 2,执行器安全性已经改变(对于1.X,执行器的安全性具有单独的配置,当它与用户配置混合时经常导致问题)。 For Spring Boot 2.X the actuator won't have separate security config. 对于Spring Boot 2.X,执行器没有单独的安全配置。 According to Spring documentation: 根据Spring文档:

For security purposes, all actuators other than /health and /info are disabled by default. 出于安全考虑,默认情况下禁用除/ health和/ info之外的所有执行器。 The management.endpoints.web.expose flag can be used to enable the actuators. management.endpoints.web.expose标志可用于启用执行器。 If Spring Security is on the classpath and no other WebSecurityConfigurerAdapter is present, the actuators are secured by Spring Boot auto-config. 如果Spring Security位于类路径上且没有其他WebSecurityConfigurerAdapter存在,则执行程序由Spring Boot auto-config保护。 If you define a custom WebSecurityConfigurerAdapter, Spring Boot auto-config will back off and you will be in full control of actuator access rules.) 如果您定义了自定义WebSecurityConfigurerAdapter,Spring Boot自动配置将退回,您将完全控制执行器访问规则。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM