programing

속성을 바인딩할 수 없습니다.

instargram 2023. 6. 21. 22:09
반응형

속성을 바인딩할 수 없습니다.

Spring Boot을 버전 1.5.6에서 2.0.0으로 업데이트했는데 많은 문제가 시작되었습니다.하나는 주제에 주어진 문제입니다.속성이 있는 수업이 있습니다.

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

구성에 사용하는 데이터

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

편집하는 동안, 그는 나를 버립니다.

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 업데이트 전에는 모든 것이 작동했습니다.

eclipseLink올바른 접두사가 아닙니다.설명서에 설명된 대로 kamelCase 대신 kebab-case를 사용해야 합니다.그래서 당신의 접두사는eclipse-link보다는eclipseLink.

Camel 케이스는 Spring boot 2.0에서 지원되지 않습니다.InvalidConfigurationPropertyNameException:구성 속성 이름 '******'이(가) 잘못되었습니다.

변경할 수 있습니다.

@ConfigurationProperties("eclipseLink")

대상:

@ConfigurationProperties("eclipselink")

속성 파일을 변경할 필요가 없습니다.이렇게 하면 오류를 방지할 수 있습니다.Spring은 eclipseLink를 찾을 수 있을 것입니다.재산

.yml 파일 중 하나의 새 구성이 모든 .yml 파일에 추가되지 않았을 때 이 문제가 발생했습니다(구체적으로 test.yml).

스프링 부트 버전을 1.5에서 2.5로 업그레이드한 후에도 동일한 문제에 직면했습니다. 여기서 kabab-case를 지원합니다. eclipse-link로 변경할 수도 있습니다.

언급URL : https://stackoverflow.com/questions/49351104/could-not-bind-properties

반응형