【发布时间】:2021-05-05 08:27:14
【问题描述】:
我尝试启用 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 定义不正确,
include= "*"应该是include: "*"。编辑:参考第一个答案,因此为什么它被解析为字符串值并且 Spring Boot Actuator 无法正确映射
标签: spring-boot spring-boot-actuator