Interface ServiceLocator


@Deprecated public interface ServiceLocator
Deprecated.
Use of out-of-the-box DI implementation recommended, or, as alternative new supplier from module maven-resolver-supplier.
A simple infrastructure to programmatically wire the various components of the repository system together when it is used outside of an IoC container. Once a concrete implementation of a service locator has been setup, clients could use
 RepositorySystem repoSystem = serviceLocator.getService( RepositorySystem.class );
 
to acquire the repository system. Components that implement Service will be given an opportunity to acquire further components from the locator, thereby allowing to create the complete object graph of the repository system.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    getService(Class<T> type)
    Deprecated.
    Gets an instance of the specified service.
    <T> List<T>
    getServices(Class<T> type)
    Deprecated.
    Gets all available instances of the specified service.
  • Method Details

    • getService

      <T> T getService(Class<T> type)
      Deprecated.
      Gets an instance of the specified service.
      Type Parameters:
      T - The service type.
      Parameters:
      type - The interface describing the service, must not be null.
      Returns:
      The service instance or null if the service could not be located/initialized.
    • getServices

      <T> List<T> getServices(Class<T> type)
      Deprecated.
      Gets all available instances of the specified service.
      Type Parameters:
      T - The service type.
      Parameters:
      type - The interface describing the service, must not be null.
      Returns:
      The (read-only) list of available service instances, never null.