在配置文件中读字段:
@PropertySource(value = "classpath:xxx.properties",encoding = "utf-8")//在springboot中可以不用添加
@Value("${key}")
private String testKey;
在配置文件中读Map:
@Value("#{${xxxxx}}")
private HashMap<String, String> testMap;
xxxxx={ key:value }
在配置文件中读字段:
@PropertySource(value = "classpath:xxx.properties",encoding = "utf-8")//在springboot中可以不用添加
@Value("${key}")
private String testKey;
在配置文件中读Map:
@Value("#{${xxxxx}}")
private HashMap<String, String> testMap;
xxxxx={ key:value }