📌  相关文章
📜  从 Spring application.properties 中获取值 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:37.313000             🧑  作者: Mango

代码示例1
public final class AppUtils {
    private static final Properties properties;

    static {
        properties = new Properties();

        try {
            ClassLoader classLoader = AppUtils.class.getClassLoader();
            InputStream applicationPropertiesStream = classLoader.getResourceAsStream("application.properties");
            applicationProperties.load(applicationPropertiesStream);
        } catch (Exception e) {
            // process the exception
        }
    }
}