code: private <V> V autoDetectService(String serviceName, ConcurrentServiceReferenceMap<String, V> map) {
          Iterator<V> services = map.getServices();
          if (services.hasNext() == false) {
              Tr.error(tc, "SECURITY_SERVICE_NO_SERVICE_AVAILABLE", serviceName);
              throw new IllegalStateException(Tr.formatMessage(tc, "SECURITY_SERVICE_NO_SERVICE_AVAILABLE", serviceName));
          }
          V service = services.next();
          if (services.hasNext()) {
              Tr.error(tc, "SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE", serviceName);
              throw new IllegalStateException(Tr.formatMessage(tc, "SECURITY_SERVICE_MULTIPLE_SERVICE_AVAILABLE", serviceName));
          }
  
          return service;
      }
docs: When the configuration element is not defined, use some "auto-detect"
  logic to try and return the single Service of a specified field. If
  there is no service, or multiple services, that is considered an error
  case which "auto-detect" can not resolve.
  
  @param serviceName name of the service
  @param map ConcurrentServiceReferenceMap of registered services
  @return id of the single service registered in map. Will not return null.