标签:city jin nbsp ppi img return 分享图片 etc this
一、代码结构
application.properties文件里配置
personal.province=JiangSu
personal.city=NanJing
@Component public class PersonalProperties { @Value("${personal.province}") private String province; @Value("${personal.city}") private String city; public String getProvince() { return province; } public void setProvince(String province) { this.province = province; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } }
@RestController public class DemoController { @Autowired PersonalProperties personalProperties; @RequestMapping("/demo") private String demo() { return personalProperties.getCity() + " , "+ personalProperties.getProvince(); } }
网页打开http://localhost:8080/demo
页面显示:NanJing , JiangSu
标签:city jin nbsp ppi img return 分享图片 etc this
原文地址:https://www.cnblogs.com/apollo-shen/p/8969150.html