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; } } 读取属性