code: private static URL discoverConfigFileUrl(String configFileName, String customConfigPropertyName) {
          URL rval;
  
          // User Defined
          ///////////////////////////////////
          String userConfig = System.getProperty(customConfigPropertyName);
          if (userConfig != null) {
              // Treat it as a URL
              try {
                  rval = new URL(userConfig);
                  return rval;
              } catch (Exception t) {
              }
              // Treat it as a file
              try {
                  File f = new File(userConfig);
                  if (f.isFile()) {
                      rval = f.toURI().toURL();
                      return rval;
                  }
              } catch (Exception t) {
              }
              throw new RuntimeException("Apiman configuration provided at [" + userConfig + "] but could not be loaded."); //$NON-NLS-1$ //$NON-NLS-2$
          }
          
          // Wildfly/EAP
          ///////////////////////////////////
          String jbossConfigDir = System.getProperty("jboss.server.config.dir"); //$NON-NLS-1$
          String jbossConfigUrl = System.getProperty("jboss.server.config.url"); //$NON-NLS-1$
          if (jbossConfigDir != null) {
              File dirFile = new File(jbossConfigDir);
              rval = findConfigUrlInDirectory(dirFile, configFileName);
              if (rval != null) {
                  return rval;
              }
          }
          if (jbossConfigUrl != null) {
              File dirFile = new File(jbossConfigUrl);
              rval = findConfigUrlInDirectory(dirFile, configFileName);
              if (rval != null) {
                  return rval;
              }
          }
  
          // Apache Tomcat
          ///////////////////////
          String tomcatHomeDir = System.getProperty("catalina.home"); //$NON-NLS-1$
          if (tomcatHomeDir != null) {
              File dirFile = new File(tomcatHomeDir, "conf"); //$NON-NLS-1$
              rval = findConfigUrlInDirectory(dirFile, configFileName);
              if (rval != null) {
                  return rval;
              }
          }
  
          // If not found, use an empty file.
          ////////////////////////////////////////
          return ConfigFileConfiguration.class.getResource("empty.properties"); //$NON-NLS-1$
      }
docs: Discover the location of the apiman.properties (for example) file by checking
  in various likely locations.