How to enable all endpoints in actuator (Spring Boot 2.0.0 RC1)
Asked Answered
S

2

65

I moved to Spring Boot 2.0.0 RC1 from 1.5.10 and I am stuck with actuator in the latest version. 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. 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=*
Statism answered 21/2, 2018 at 8:10 Comment(2)
See https://mcmap.net/q/302391/-spring-boot-2-actuator-metrics-endpoint-not-working for a very detailed responseDemasculinize
As mentioned in the link @Demasculinize posted. Old properties starting with endpoints.xyz are deprecated in favor of properties starting with management.xyz. So yes using any recent version of SpringBoot you should rely on management.endpoints properties and remove root endpoints configurations.Inflexible
C
148

With Spring Boot 2.0.0.RC1, actuator endpoints must be 1) enabled and 2) exposed.

By default, all endpoints but shutdown are enabled and only health and info are exposed.

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:

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:

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

Spring Boot 2.0.0.RC1:

management:
  endpoints:
    web:
      expose: "*"
Chapel answered 21/2, 2018 at 8:27 Comment(3)
I tested the solution for RC1 and it works perfectly. Upvoting. Many thanks.Statism
In application.yml I had to enter it as include: "*"Clarethaclaretta
For me single quotes worked like include: '*'Bedcover
C
2

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). For Spring Boot 2.X the actuator won't have separate security config. According to Spring documentation:

For security purposes, all actuators other than /health and /info are disabled by default. The management.endpoints.web.expose flag can be used to enable the actuators. If Spring Security is on the classpath and no other WebSecurityConfigurerAdapter is present, the actuators are secured by 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.)

Calais answered 21/2, 2018 at 15:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.