Spring Boot Actuator:无法绑定属性
Spring Boot Actuator: Failed to bind properties under
我尝试启用 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
-文件中的以下 :
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: "*"
我的问题已通过添加以下 Maven 依赖项得到解决
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator-autoconfigure</artifactId>
</dependency>
我尝试启用 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
-文件中的以下
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: "*"
我的问题已通过添加以下 Maven 依赖项得到解决
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator-autoconfigure</artifactId>
</dependency>