Spring Boot Actuator:无法绑定下的属性 [英] Spring Boot Actuator: Failed to bind properties under

查看:56
本文介绍了Spring Boot Actuator:无法绑定下的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试启用 Spring Boot Actuator(与 Swagger 一起)并在 pom.xml

I try to enable Spring Boot Actuator (together with Swagger) and have in the pom.xml

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>2.4.5</version>
    </dependency>

yml 文件中使用以下 config:

with the following config in the yml-file:

springdoc:
  api-docs:
    enabled: true
  show:
    actuator: true  


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

当我启动它时,我收到以下异常:

When I launch it I get the following exception:

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'management.endpoints.web.exposure' to org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties$Exposure:

    Reason: No converter found capable of converting from type [java.lang.String] to type [org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties$Exposure]

Action:

Update your application's configuration

如何修复此异常?

推荐答案

你的 YAML 有一个 = 而不是 :

Your YAML has a = instead of a :

并删除暴露:

错误:

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

正确:

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

这篇关于Spring Boot Actuator:无法绑定下的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆