Spring boot application.yml number属性已更改

Spring boot application.yml number属性已更改,spring-boot,Spring Boot,My application.yml如下所示: test: icode: 0002 但当我得到这个值时: @Value("${baidu.icode}") private String icode; icode字段是2.0,但我希望它是0002,我该怎么办?要确保YAML属性保持完全相同,只需将它们用引号括起来: test: icode: "0002" 要确保YAML属性保持完全相同,只需将它们用引号括起来: test: icode: "0002" @值在静态字段上不起作用。

My application.yml如下所示:

test:
  icode: 0002
但当我得到这个值时:

@Value("${baidu.icode}")
private String icode;

icode字段是2.0,但我希望它是0002,我该怎么办?

要确保YAML属性保持完全相同,只需将它们用引号括起来:

test:
  icode: "0002"

要确保YAML属性保持完全相同,只需将它们用引号括起来:

test:
  icode: "0002"

@值在静态字段上不起作用。@M.Deinum谢谢!我已经删除了静态。@Value对静态字段无效。@M.Deinum谢谢!我已经删除了静态。@JuzerAli啊好的!很抱歉我忘了。@JuzerAli啊好的!对不起,我忘了。