Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 属性扩展未与配置属性类正确绑定_Spring_Spring Boot_Kotlin_Yaml - Fatal编程技术网

Spring 属性扩展未与配置属性类正确绑定

Spring 属性扩展未与配置属性类正确绑定,spring,spring-boot,kotlin,yaml,Spring,Spring Boot,Kotlin,Yaml,使用ConfigurationProperties绑定属性时,无法正确解析属性扩展。或者更具体地说,当要扩展的属性不存在时,绑定不会失败,并且属性名称用作值 让我们看看下面的场景 //绑定类 开放类MyProperties{ lateinit var myValue:字符串 } //配置 @配置 @EnableConfigurationProperties 类MyConfig{ @豆子 @配置属性(前缀=“my.properties”) 趣味myProperties():myProperties

使用
ConfigurationProperties
绑定属性时,无法正确解析属性扩展。或者更具体地说,当要扩展的属性不存在时,绑定不会失败,并且属性名称用作值

让我们看看下面的场景

//绑定类
开放类MyProperties{
lateinit var myValue:字符串
}
//配置
@配置
@EnableConfigurationProperties
类MyConfig{
@豆子
@配置属性(前缀=“my.properties”)
趣味myProperties():myProperties=myProperties()
}
##弹簧特性yaml
my.properties:
我的值:${my.other.value}
当正在展开的属性
my.other.value
存在时,则该值存在于
MyProperties\myValue
中;但是,当属性
my.other.value
不存在时,原始字符串
“${my.other.value}”
将加载到
MyProperties\myValue


有没有办法强迫应用程序尝试扩展属性(并且无法启动),而不是使用扩展表达式作为值?

FTR,OP已在Spring Boot issue tracker上交叉发布此信息:FTR,OP已在Spring Boot issue tracker上交叉发布此信息: