我正在使用 Spring Boot 并在我的 application.yml 中使用这个值
config:
  username: abc
  password: xyz
在我的课堂上,我这样使用它 -
@Value("${config.username}")
    private String username;
我收到以下错误 -
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'config.username' in value "${config.username}"
但是,如果我在 application.yml 文件中使用它,它就可以工作。你能告诉我我在这里做错了什么吗?
config.username: abc
config.password: xyz
| 归档时间: | 
 | 
| 查看次数: | 11734 次 | 
| 最近记录: |