无法绑定属性 [英] Could not bind properties

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

问题描述

我已经将Spring Boot从1.5.6版本更新到了2.0.0,并且出现了很多问题。一是该主题中给出的问题。
我有一个带有属性的类

I've updated Spring Boot from version 1.5.6 to 2.0.0 and a lot of problems have started. One is the problem given in the subject. I have a class with properties

@Data
@ConfigurationProperties("eclipseLink")
public class EclipseLinkProperties { ... }

我在配置中使用

@Configuration
@EnableConfigurationProperties(EclipseLinkProperties.class)
public class WebDatasourceConfig { ... }

在编译过程中,他把我扔掉了

during compilation, he throws me away

2018-03-18 18:44:58.560  INFO 3528 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.context.properties.ConversionServiceDeducer$Factory' of type [org.springframework.boot.context.properties.ConversionServiceDeducer$Factory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2018-03-18 18:44:58.575  WARN 3528 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webDatasourceConfig': Unsatisfied dependency expressed through field 'eclipseLinkProperties'; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'eclipseLink-com.web.web.config.properties.EclipseLinkProperties': Could not bind properties to 'EclipseLinkProperties' : prefix=eclipseLink, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.source.InvalidConfigurationPropertyNameException: Configuration property name 'eclipseLink' is not valid

这意味着

Configuration property name 'eclipseLink' is not valid

在Spring Boot更新之前,一切正常。

Before the Spring Boot update everything worked.

推荐答案

eclipseLink 不是有效的前缀。如中所述文档使用kebab-case而不是camelCase。因此,您的前缀应为 eclipse-link 而不是 eclipseLink

eclipseLink isn't a valid prefix. As described in the documentation kebab-case should be used rather than camelCase. So your prefix should be eclipse-link rather than eclipseLink.

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

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