title: Is it worth to use singleton to load a configuration file?
body: <p>I have a java web applilication. This application loads its configuration file with singleton according source file below.</p>
  <pre><code>public class Configuration {
  private static Configuration config;
  private static Properties prop = null;
  private static InputStream input = null;
  
  private Configuration() {
  
          input = this.getClass().getResourceAsStream(&quot;/config.properties&quot;);
          prop = new Properties();
          prop.load(input);
  
          input = new FileInputStream(prop.getProperty(&quot;soap.config&quot;));
          prop = new Properties(prop);
          prop.load(new InputStreamReader(input, StandardCharsets.UTF_8));
  }
  
  public static Configuration getInstance() {
      if (config == null) {
          config = new Configuration();
      }
      return config;
  }
  
  }
  </code></pre>
  <p>config.properties (located into resources folder of java project)</p>
  <pre><code>soap.config=/home/wildfly/soap.propeties
  </code></pre>
  <p>Content of soap.properties file:</p>
  <pre><code>server=192.168.1.1
  user=John
  pass=thepass
  </code></pre>
  <p>Server features:
  Total memory: 8GBram. 30% ram used
  1 core, 40gb hard disk
  Widfly Server
  linux virtual machine</p>
  <p>If I want to change some value in config file, it's necessary to restart the aplication by Wildfly admin console also. I think it's more useful to change config file values without restarting the application.</p>
  <p>Additionally, the application receives more than thousands request a day and I see server status is fine.</p>
  <p>Questions:</p>
  <ul>
  <li>Is it beneficial or worth to use singleton to load a configuration file?</li>
  <li>The instruction this.getClass().getResourceAsStream(&quot;/config.properties&quot;) will read the config file and after that it will close it inmediatelly. Is it correct?</li>
  </ul>