Package org.apache.cayenne.di.spi

# Class ModuleLoader

java.lang.Object
org.apache.cayenne.di.spi.ModuleLoader

public class ModuleLoader extends Object
Auto-loads DI modules using ServiceLoader. To make a module auto-loadable, you will need to ship the jar with a file "META-INF/services/<full.provider.class.name>" that contains provider implementation for the module in question.

Since:
  4.0
See Also:
  - `ModuleProvider`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ModuleLoader()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<Module>`
  `load(Class<? extends ModuleProvider> providerClass)`
  Auto-loads all modules declared on classpath.
  `List<Module>`
  `load(Class<? extends ModuleProvider> providerClass, ClassLoader classLoader)`
  Auto-loads all modules declared on classpath.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ModuleLoader

    public ModuleLoader()

- ## Method Details

  - ### load

    public List<Module> load(Class<? extends ModuleProvider> providerClass)
    Auto-loads all modules declared on classpath. Modules are loaded from the SPI declarations stored in "META-INF/services/<full.provider.class.name>", and then sorted in the order of override dependency.
    Returns:
      a sorted collection of auto-loadable modules.
    Throws:
      `DIRuntimeException` - if auto-loaded modules have circular override dependencies.

  - ### load

    public List<Module> load(Class<? extends ModuleProvider> providerClass, ClassLoader classLoader)
    Auto-loads all modules declared on classpath. Modules are loaded from the SPI declarations stored in "META-INF/services/<full.provider.class.name>", and then sorted in the order of override dependency.
    Returns:
      a sorted collection of auto-loadable modules.
    Throws:
      `DIRuntimeException` - if auto-loaded modules have circular override dependencies.
    Since:
      4.2