Package org.springframework.beans.factory.aot

# Class AotServices<T>

java.lang.Object
org.springframework.beans.factory.aot.AotServices<T>

Type Parameters:
  `T` - the service type

All Implemented Interfaces:
  `Iterable<T>`

public final class AotServices<T> extends Object implements Iterable<T>
A collection of AOT services that can be `loaded` from a `SpringFactoriesLoader` or obtained from a `ListableBeanFactory`.

Since:
  6.0
Author:
  Phillip Webb

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`AotServices.Loader`
Loader class used to actually load the services.
`static enum`
`AotServices.Source`
Sources from which services were obtained.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`FACTORIES_RESOURCE_LOCATION`
The location to look for AOT factories.

## Method Summary

Modifier and Type
Method
Description
`List<T>`
`asList()`
Return the AOT services as a `List`.
`static AotServices.Loader`
`factories()`
Create a new `AotServices.Loader` that will obtain AOT services from "META-INF/spring/aot.factories".
`static AotServices.Loader`
`factories(ClassLoader classLoader)`
Create a new `AotServices.Loader` that will obtain AOT services from "META-INF/spring/aot.factories".
`static AotServices.Loader`
`factories(org.springframework.core.io.support.SpringFactoriesLoader springFactoriesLoader)`
Create a new `AotServices.Loader` that will obtain AOT services from the given `SpringFactoriesLoader`.
`static AotServices.Loader`
`factoriesAndBeans(ListableBeanFactory beanFactory)`
Create a new `AotServices.Loader` that will obtain AOT services from "META-INF/spring/aot.factories" as well as the given `ListableBeanFactory`.
`static AotServices.Loader`
`factoriesAndBeans(org.springframework.core.io.support.SpringFactoriesLoader springFactoriesLoader, ListableBeanFactory beanFactory)`
Create a new `AotServices.Loader` that will obtain AOT services from the given `SpringFactoriesLoader` and `ListableBeanFactory`.
`T`
`findByBeanName(String beanName)`
Find the AOT service that was loaded for the given bean name.
`AotServices.Source`
`getSource(T service)`
Get the source of the given service.
`Iterator<T>`
`iterator()`
`Stream<T>`
`stream()`
Return a `Stream` of the AOT services.

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

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

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

## Field Details

### FACTORIES_RESOURCE_LOCATION

public static final String FACTORIES_RESOURCE_LOCATION
The location to look for AOT factories.

See Also:
  - Constant Field Values

## Method Details

### factories

public static AotServices.Loader factories()
Create a new `AotServices.Loader` that will obtain AOT services from "META-INF/spring/aot.factories".

Returns:
  a new `AotServices.Loader` instance

### factories

public static AotServices.Loader factories(@Nullable ClassLoader classLoader)
Create a new `AotServices.Loader` that will obtain AOT services from "META-INF/spring/aot.factories".

Parameters:
  `classLoader` - the class loader used to load the factories resource
Returns:
  a new `AotServices.Loader` instance

### factories

public static AotServices.Loader factories(org.springframework.core.io.support.SpringFactoriesLoader springFactoriesLoader)
Create a new `AotServices.Loader` that will obtain AOT services from the given `SpringFactoriesLoader`.

Parameters:
  `springFactoriesLoader` - the spring factories loader
Returns:
  a new `AotServices.Loader` instance

### factoriesAndBeans

public static AotServices.Loader factoriesAndBeans(ListableBeanFactory beanFactory)
Create a new `AotServices.Loader` that will obtain AOT services from "META-INF/spring/aot.factories" as well as the given `ListableBeanFactory`.

Parameters:
  `beanFactory` - the bean factory
Returns:
  a new `AotServices.Loader` instance

### factoriesAndBeans

public static AotServices.Loader factoriesAndBeans(org.springframework.core.io.support.SpringFactoriesLoader springFactoriesLoader, ListableBeanFactory beanFactory)
Create a new `AotServices.Loader` that will obtain AOT services from the given `SpringFactoriesLoader` and `ListableBeanFactory`.

Parameters:
  `springFactoriesLoader` - the spring factories loader
  `beanFactory` - the bean factory
Returns:
  a new `AotServices.Loader` instance

### iterator

public Iterator<T> iterator()

Specified by:
  `iterator` in interface `Iterable<T>`

### stream

public Stream<T> stream()
Return a `Stream` of the AOT services.

Returns:
  a stream of the services

### asList

public List<T> asList()
Return the AOT services as a `List`.

Returns:
  a list of the services

### findByBeanName

@Nullable public T findByBeanName(String beanName)
Find the AOT service that was loaded for the given bean name.

Parameters:
  `beanName` - the bean name
Returns:
  the AOT service or `null`

### getSource

public AotServices.Source getSource(T service)
Get the source of the given service.

Parameters:
  `service` - the service instance
Returns:
  the source of the service