如何解决Spring Boot Actuator:无法绑定下的属性
我尝试启用 Spring Boot Actuator(与 Swagger 一起)并在 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:
springdoc:
api-docs:
enabled: true
show:
actuator: true
management:
endpoints:
web:
exposure:
include= "*"
expose: "*"
当我启动它时,我收到以下异常:
***************************
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 有一个 = 而不是 :
并删除暴露:
错误:
management:
endpoints:
web:
exposure:
include= "*"
expose: "*"
正确:
management:
endpoints:
web:
exposure:
include: "*"
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。