All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.ebeaninternal.server.core.ClassPathScanners Maven / Gradle / Ivy

There is a newer version: 15.8.1
Show newest version
package io.ebeaninternal.server.core;

import io.ebean.config.ServerConfig;
import org.avaje.classpath.scanner.ClassPathScanner;
import org.avaje.classpath.scanner.ClassPathScannerFactory;

import java.util.ArrayList;
import java.util.List;
import java.util.ServiceLoader;

/**
 * Utility to finds and return the list of ClassPathScanner services.
 */
public class ClassPathScanners {

  /**
   * Return the list of ClassPathScanner services using serverConfig service loader.
   */
  public static List find(ServerConfig serverConfig) {

    List scanners = new ArrayList<>();

    ServiceLoader scannerLoader = serverConfig.serviceLoad(ClassPathScannerFactory.class);
    for (ClassPathScannerFactory factory : scannerLoader) {
      ClassPathScanner scanner = factory.createScanner(serverConfig.getClassLoadConfig().getClassLoader());
      scanners.add(scanner);
    }

    return scanners;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy