我需要读取映射中 application.properties 文件中的所有属性 在下面的代码中,属性测试具有相应的值,但映射为空。如何使用 application.properties 文件中的值填充“map”而不向属性添加前缀。
这是我的 application.properties 文件
AAPL=25
GDDY=65
test=22
Run Code Online (Sandbox Code Playgroud)
我正在像这样使用@ConfigurationProperties
@Configuration
@ConfigurationProperties("")
@PropertySource("classpath:application.properties")
public class InitialConfiguration {
private HashMap<String, BigInteger> map = new HashMap<>();
private String test;
public HashMap<String, BigInteger> getMap() {
return map;
}
public void setMap(HashMap<String, BigInteger> map) {
this.map = map;
}
public String getTest() {
return test;
}
public void setTest(String test) {
this.test = test;
}
}
Run Code Online (Sandbox Code Playgroud)