/**
* @ProjectName traffic
* @ClassName UrlInfo
* @Desicription 获取yaml配置文件中的内容
* @Author Zhang Xueliang
* @Date 2019/3/23 14:12
* @Version 1.0
**/
@Component
@ConfigurationProperties(prefix = "url")
public class UrlInfo {
private String trafficUrl;
public String getTrafficUrl() {
return trafficUrl;
}
public void setTrafficUrl(String trafficUrl) {
this.trafficUrl = trafficUrl;
}
}
测试调用:
@Autowired
private UrlInfo urlInfo;
@Test
public void testProp(){
System.err.println("================> "+urlInfo.getTrafficUrl());
}