无法绑定属性

编程入门 行业动态 更新时间:2024-10-22 23:35:05
本文介绍了无法绑定属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经将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.

更多推荐

无法绑定属性

本文发布于:2023-11-12 12:31:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581504.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   属性

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!