code: public static <T> List<T> loadPlugins(final Class<T> type) {
      ServiceLoader<T> serviceLoader = ServiceLoader.load(type);
      Iterator<T> it = serviceLoader.iterator();
      if (!it.hasNext()) {
        LOG.warn("Unable to locate any plugins of the type: " + type.getName());
        return null;
      }
      
      ArrayList<T> plugins = new ArrayList<T>();
      while(it.hasNext()) {
        plugins.add(it.next());
      }
      if (plugins.size() > 0) {
        return plugins;
      }
      
      LOG.warn("Unable to locate plugins for type: " + type.getName());
      return null;
    }
docs: Searches the class path for implementations of the given type, returning a
  list of all plugins that were found
  <p>
  <b>Note:</b> If you want to load JARs dynamically, you need to call
  {@link #loadJAR} or {@link #loadJARs} methods with the proper file
  or directory first, otherwise this will only search whatever was loaded
  on startup.
  <p>
  <b>WARNING:</b> If there are multiple versions of the request plugin in the
  class path, only one will be returned, so check the logs to see that the
  correct version was loaded.
  
  @param type The class type to search for
  @return An instantiated list of objects of the given type if found, null
  if no implementations of the type were found
  @throws ServiceConfigurationError if any of the plugins could not be
  instantiated