Could not bind properties
Asked Answered
R

5

23

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 { ... }

which I use in configuration

@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

It means

Configuration property name 'eclipseLink' is not valid

Before the Spring Boot update everything worked.

Raquelraquela answered 18/3, 2018 at 17:51 Comment(0)
R
37

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.

Reticule answered 18/3, 2018 at 18:2 Comment(0)
C
7

You can change:

@ConfigurationProperties("eclipseLink")

to:

@ConfigurationProperties("eclipselink")

You don't need to change properties file. This will avoid error. Spring will be able to find eclipseLink.* properties.

Cook answered 21/7, 2021 at 22:25 Comment(0)
C
4

Camel case is not supported in Spring boot 2.0. It would throw InvalidConfigurationPropertyNameException: Configuration property name '********' is not valid.

Crasis answered 12/4, 2018 at 10:25 Comment(0)
S
0

Faced this issue when a new config in one of the .yml files was not added in all .yml files(test.yml to be specific)

Sloop answered 19/8, 2020 at 13:51 Comment(0)
V
0

Faced same issue after upgrade spring boot version from 1.5 to 2.5 here it support kabab-case you can also change to eclipse-link

Valley answered 9/8, 2022 at 7:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.