code: public static Properties configFromResource(final String resource) {
          InputStream input = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
          if (input == null) {
              // non-existent resource will *not* throw an exception, do this anyway
              throw new IllegalArgumentException("configuration file '" + resource + "' not found on classpath");
          }
  
          final Properties config = new Properties();
          try {
              config.load(input);
          }
          catch (final IOException e) {
              throw new IllegalArgumentException("reading configuration from '" + resource + "' failed", e);
          }
          return config;
      }
docs: Reads configuration from a classpath resource stream obtained from the current thread's class loader through
  {@link ClassLoader#getSystemResourceAsStream(String)}.
  
  @param resource The resource to be read.
  @return A {@link java.util.Properties} object read from the specified resource.
  @throws IllegalArgumentException When the configuration file could not be found or another I/O error occurs.