/** * Atomically load the properties file at the given location within the designated class loader. * * @param classLoader the class loader; may not be null * @param classpathResource the path to the resource file; may not be null * @return the properties object; never null, but possibly empty * @throws IllegalStateException if the file could not be found or read */ public static Properties loadProperties(ClassLoader classLoader, String classpathResource) { return loadProperties(() -> classLoader, classpathResource); }
/** * Atomically load the properties file at the given location within the designated class' class loader. * * @param clazz the class whose class loader is to be used; may not be null * @param classpathResource the path to the resource file; may not be null * @return the properties object; never null, but possibly empty * @throws IllegalStateException if the file could not be found or read */ public static Properties loadProperties(Class<?> clazz, String classpathResource) { return loadProperties(clazz::getClassLoader, classpathResource); }
/** * Atomically load the properties file at the given location within the designated class' class loader. * * @param clazz the class whose class loader is to be used; may not be null * @param classpathResource the path to the resource file; may not be null * @return the properties object; never null, but possibly empty * @throws IllegalStateException if the file could not be found or read */ public static Properties loadProperties(Class<?> clazz, String classpathResource) { return loadProperties(clazz::getClassLoader, classpathResource); }
/** * Atomically load the properties file at the given location within the designated class loader. * * @param classLoader the class loader; may not be null * @param classpathResource the path to the resource file; may not be null * @return the properties object; never null, but possibly empty * @throws IllegalStateException if the file could not be found or read */ public static Properties loadProperties(ClassLoader classLoader, String classpathResource) { return loadProperties(() -> classLoader, classpathResource); }