java - 为什么在我的例子中 Spring Boot Actuator 不显示/info,/actuator 端点?

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

每次我在请求 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

最佳答案

无法发表评论

你可以尝试下面的 yml 吗,因为不带双引号的 Star(*) 在我的 IDE 中无效,可能你的问题是相同的

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

关于java - 为什么在我的例子中 Spring Boot Actuator 不显示/info,/actuator 端点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58323415/

相关文章:

java - Android studio - 如何在应用程序主题中使用三星的 TouchWiz 皮肤?

java - Spring aop 切入点表达式访问方法返回类型

java - spring auth错误没有AuthenticationProvider

java - 系统属性的 Spring @value 给出 null

java - 将 'mean' 、 'min' 或 'percentiles' 添加到 Spring Boot 2 指标?

java - 使用 SpringBoot CrudRepository 查找一个已知条目

java - 如何在 JavaSE/EE 中使用笔记本电脑摄像头和 Zxing 读取二维码?

java - 在哪里可以下载官方 Mockito jar 文件以与 Eclipse 中的 Apache ant 项目一起使用?

java - SWT java 浏览器退格键停止工作

java - 带有Spring Boot的RESTful Web服务中的授权和身份验证