首页 > 解决方案 > 执行器暴露端点在 spring boot2.5.2 中不起作用

问题描述

当我使用执行器暴露端点时,我使用 springboot 2.5.2 版本,它显示了一些错误:

09:48:48.938 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.yaml.snakeyaml.scanner.ScannerException: while scanning an alias
 in 'reader', line 18, column 18:
            include: *
                     ^
unexpected character found  (0)
 in 'reader', line 18, column 19:
            include: *
                      ^

引导程序.yml:

management:
  endpoints:
    web:
      exposure:
        include: *

我在我的 gradle.kt 中使用执行器 gradle 依赖,但为什么我在 yml 文件中声明管理端点时遇到问题?

标签: spring-bootspring-boot-actuator

解决方案


*是 YAML 中的特殊字符。它为一个值添加前缀以表明它是一个别名。要将其用作字符串,正如您在此处所做的那样,请将其用引号括起来:

management:
  endpoints:
    web:
      exposure:
        include: '*'

推荐阅读