【问题标题】:Why in my case Spring Boot Actuator does not show /info, /actuator endpoints?为什么在我的情况下 Spring Boot Actuator 不显示 /info、/actuator 端点?
【发布时间】:2020-02-07 22:17:04
【问题描述】:

每次我在询问 localhost:60001/infolocalhost:60001/actuator 或其他人时遇到 404 错误。

{"timestamp":1570711643410,"status":404,"error":"Not Found","message":"No message available","path":"/loginfo"}

它仅适用于localhost:60001/metricslocalhost:60001/health

在我的 application.yml 文件中,我添加了所有设置以启用所有可能的端点。

management:
  server:
    port: 60001
  security:
    enabled: false
  endpoint:
    beans:
      enabled: true
    health:
      show-details: ALWAYS
  endpoints:
    sensitive: true
    web:
      exposure:
        include: *

PS:我也有疑问,为什么我会在application.yml中写管​​理设置有错误,为什么JAR文件构建成功。例如,show-details: SOME_NOT_EXISTING_THING 而不是 show-details: ALWAYS

我还添加了我在Baeldung tutorial for Spring Boot 2.x Actuator 中看到的SecurityWebFilterChain bean

@Bean
public SecurityWebFilterChain securityWebFilterChain(
  ServerHttpSecurity http) {
    return http.authorizeExchange()
      .pathMatchers("/actuator/**").permitAll()
      .anyExchange().authenticated()
      .and().build();
}

我尝试了所有可能的localhost:60001/链接,这些链接已经写在这个stackoverflow issue中。

PS:http://hostname:portnumber/applicationroot/actuator/healthhttp://localhost:60001/loginfo 等。但是还是不行。

我使用 Spring Boot 2.1.6:RELEASE

【问题讨论】:

  • 您使用的是哪个 Spring Boot 版本?
  • @Shailesh 我使用 Spring Boot 2.1.6:RELEASE

标签: java spring spring-boot spring-boot-starter


【解决方案1】:

无法在 cmets 中发帖

你能在 yml 下面试试吗,因为没有双引号的 Star(*) 在我的 IDE 中无效,可能是你的问题是一样的

management:
  endpoints:
    enabled-by-default: true
    web:
      exposure:
        include:
        - "*"

【讨论】:

猜你喜欢
  • 2021-08-25
  • 2016-03-27
  • 2016-06-01
  • 1970-01-01
  • 2020-09-15
  • 2016-09-07
  • 2021-04-24
  • 2021-04-30
  • 1970-01-01
相关资源
最近更新 更多