spring属性占位符始终提供默认值

spring属性占位符始终提供默认值,spring,Spring,在下面的示例中,我发现无论占位符中有什么值,sampleWeight始终被视为默认值0.0。如果我删除默认值,那么它会选择正确的占位符值 @Configuration public class XYZConfiguration { @Value("${properties.xyz:0.0}") private double sampleWeightWithDefault; @Value("${{properties.xyz}") private double sampleWeight; @

在下面的示例中,我发现无论占位符中有什么值,sampleWeight始终被视为默认值0.0。如果我删除默认值,那么它会选择正确的占位符值

@Configuration
public class XYZConfiguration {

@Value("${properties.xyz:0.0}")
private double sampleWeightWithDefault;

@Value("${{properties.xyz}")
private double sampleWeight;

@Bean(initMethod = "start", destroyMethod = "stop")
Profile profiler() {
  LOGGER.error("sampleWeightWithDefault:" + sampleWeightWithDefault);
  LOGGER.error("sampleWeight:" + sampleWeight);
  return new Profile(sampleWeight);
}
o/p: sampleWeightWithDefault:0.0
sampleWeight:1.0

是不是
{
只是一个打字错误?只是复制过程中的一个打字错误