我需要将application.properties文件中的所有属性读入到一个映射中
在下方的代码中,属性test有相应的值,但是映射为空。如何在不添加前缀的情况下填充“map”以包含application.properties文件中的值。
这是我的application.properties文件
AAPL=25
GDDY=65
test=22
我正在这样使用@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;
}
}