@Configuration
//配置文件位置
@PropertySource("classpath:city.properties")
//前缀
@ConfigurationProperties(prefix = "city")
public class CityProperties {

private Map<String,Integer> map = new HashMap<>();

public Map<String, Integer> getMap() {
return map;
}

public void setMap( Map<String, Integer> map) {
this.map = map;
}
}


city.map.V0441201=350
city.map.V0350600=351
city.map.V0520100=358
city.map.V0441800=363
city.map.V0330100=373
city.map.V0430400=374
city.map.V0130600=390


另一种

  
@Value(value = "${R.host}")
public String Rhost;

@Value(value = "${R.port}")
public String Rport;

在application中写
      
R.host=localhost
R.port=6311


相关文章:

  • 2022-12-23
  • 2021-08-24
  • 2022-12-23
  • 2022-02-08
  • 2021-10-11
  • 2022-12-23
  • 2021-07-09
  • 2022-01-12
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2021-12-28
  • 2022-12-23
  • 2021-05-21
相关资源
相似解决方案