org.springframework.beans.factory.serviceloader

## Class ServiceLoaderFactoryBean

- java.lang.Object
- - org.springframework.beans.factory.config.AbstractFactoryBean
  - - org.springframework.beans.factory.serviceloader.AbstractServiceLoaderBasedFactoryBean
    - - org.springframework.beans.factory.serviceloader.ServiceLoaderFactoryBean

- All Implemented Interfaces:
    Aware, BeanClassLoaderAware, BeanFactoryAware, DisposableBean, FactoryBean, InitializingBean

      public class ServiceLoaderFactoryBean
      extends AbstractServiceLoaderBasedFactoryBean
      implements BeanClassLoaderAware

  `FactoryBean` that exposes the JDK 1.6 `ServiceLoader` for the configured service class.
  Since:
    2.5
  Author:
    Juergen Hoeller
  See Also:
    `ServiceLoader`

- - ### Field Summary

    - ### Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

      `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServiceLoaderFactoryBean()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Object` | `getObjectToExpose(ServiceLoader serviceLoader)` Determine the actual object to expose for the given ServiceLoader.
    `Class` | `getObjectType()` This abstract method declaration mirrors the method in the FactoryBean interface, for a consistent offering of abstract template methods.

    - ### Methods inherited from class org.springframework.beans.factory.serviceloader.AbstractServiceLoaderBasedFactoryBean

      `createInstance, getServiceType, setBeanClassLoader, setServiceType`

    - ### Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

      `afterPropertiesSet, destroy, destroyInstance, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanFactory, setSingleton`

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

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

    - ### Methods inherited from interface org.springframework.beans.factory.BeanClassLoaderAware

      `setBeanClassLoader`

- - ### Constructor Detail

    - #### ServiceLoaderFactoryBean

          public ServiceLoaderFactoryBean()

  - ### Method Detail

    - #### getObjectToExpose

          protected Object getObjectToExpose(ServiceLoader serviceLoader)

      Description copied from class: `AbstractServiceLoaderBasedFactoryBean`
      Determine the actual object to expose for the given ServiceLoader.

      Left to concrete subclasses.

      Specified by:
        `getObjectToExpose` in class `AbstractServiceLoaderBasedFactoryBean`
      Parameters:
        `serviceLoader` - the ServiceLoader for the configured service class
      Returns:
        the object to expose

    - #### getObjectType

          public Class getObjectType()

      Description copied from class: `AbstractFactoryBean`
      This abstract method declaration mirrors the method in the FactoryBean interface, for a consistent offering of abstract template methods.
      Specified by:
        `getObjectType` in interface `FactoryBean`
      Specified by:
        `getObjectType` in class `AbstractFactoryBean`
      Returns:
        the type of object that this FactoryBean creates, or `null` if not known at the time of the call
      See Also:
        `FactoryBean.getObjectType()`