Yaml配置文件
oauth2:
baseUrl:
属性注入
@Component
public class PropertiesTest {
private static String baseUrl;
@Value("${oauth2.baseUrl}")
private String url;
@PostConstruct
public void getUrl() throws Exception {
baseUrl = this.url;
}
public static String getBaseUrl() {
return baseUrl;
}
}
读取属性
![读取属性](https://i-blog.csdnimg.cn/blog_migrate/d5c6ad55ff7a81d97effc6d514c4241c.png)