我正在将一个应用程序升级到SpringBoot2.1.3(从1.5.x开始),在启动时我面临一个问题。下面的块无法正确绑定:
spring:
zipkin:
enabled: true
base-url: http://myZipkinServer
sender:
type: web
我得到这个错误:
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under 'spring.zipkin.sender.type' to org.springframework.cloud.sleuth.zipkin2.sender.ZipkinSenderProperties$SenderType:
Property: spring.zipkin.sender.type
Value: web
Origin: class path resource [application.yml]:68:13
Reason: 0
Action:
Update your application's configuration
在我收到警告日志宣布问题之前:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.zipkin.sender-org.springframework.cloud.sleuth.zipkin2.sender.ZipkinSenderProperties': Could not bind properties to 'ZipkinSenderProperties' : prefix=spring.zipkin.sender, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.zipkin.sender.type' to org.springframework.cloud.sleuth.zipkin2.sender.ZipkinSenderProperties$SenderType
我试图在调试中跟进,最终我深入到了Spring Boot的内部
在里面
org.springframework.boot.context.properties.bind.Binder
.
我有一个类似的应用程序,它的版本或多或少都是相同的,而且运行得很好。我试图找出不同之处,比较执行流,但没有发现任何明显的差异。
在IntelliJ中,我得到了自动完成,因此我知道我的yaml格式正确:“web”值是向我提出的。
你知道如何调查这类问题吗?