Top Description Inners Fields Constructors Methods
org.springframework.beans.factory.aot

public final Class AotServices<T>

extends Object
implements Iterable<T>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable
Type Parameters
<T>
the service type
Imports
java.util.ArrayList, .Collection, .Collections, .IdentityHashMap, .Iterator, .List, .Map, java.util.stream.Stream, org.springframework.beans.factory.BeanFactory, .BeanFactoryUtils, .ListableBeanFactory, org.springframework.beans.factory.config.ConfigurableBeanFactory, org.springframework.core.annotation.AnnotationAwareOrderComparator, org.springframework.core.io.support.SpringFactoriesLoader, org.springframework.lang.Nullable, org.springframework.util.Assert, .ObjectUtils

A collection of AOT services that can be loaded from a SpringFactoriesLoader or obtained from a ListableBeanFactory.
Author
Phillip Webb
Since
6.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
AotServices.Loader

Loader class used to actually load the services.

public static enum
AotServices.Source

Sources from which services were obtained.

Field Summary

Modifier and TypeField and Description
private final Map<String, T>
public static final String
FACTORIES_RESOURCE_LOCATION

The location to look for AOT factories.

private final List<T>
private final Map<T, AotServices.Source>

Constructor Summary

AccessConstructor and Description
private
AotServices(List<T> loaded, Map<String, T> beans)

Method Summary

Modifier and TypeMethod and Description
public List<T>

Returns:

a list of the services
asList
()

Return the AOT services as a List.

private List<T>
collectServices(List<T> loaded, Map<String, T> beans)

private Map<T, AotServices.Source>
collectSources(Collection<T> loaded, Collection<T> beans)

public static AotServices.Loader

Returns:

a new Loader instance
factories
()

Create a new Loader that will obtain AOT services from META-INF/spring/aot.factories.

public static AotServices.Loader

Returns:

a new Loader instance
factories
(ClassLoader
the class loader used to load the factories resource
classLoader
)

Create a new Loader that will obtain AOT services from META-INF/spring/aot.factories.

public static AotServices.Loader

Returns:

a new Loader instance
factories
(SpringFactoriesLoader
the spring factories loader
springFactoriesLoader
)

Create a new Loader that will obtain AOT services from the given SpringFactoriesLoader.

public static AotServices.Loader

Returns:

a new Loader instance
factoriesAndBeans
(ListableBeanFactory
the bean factory
beanFactory
)

Create a new Loader that will obtain AOT services from META-INF/spring/aot.factories as well as the given ListableBeanFactory.

public static AotServices.Loader

Returns:

a new Loader instance
factoriesAndBeans
(SpringFactoriesLoader
the spring factories loader
springFactoriesLoader
,
ListableBeanFactory
the bean factory
beanFactory
)

Create a new Loader that will obtain AOT services from the given SpringFactoriesLoader and ListableBeanFactory.

public T

Returns:

the AOT service or null
findByBeanName
(String
the bean name
beanName
)

Find the AOT service that was loaded for the given bean name.

public AotServices.Source

Returns:

the source of the service
getSource
(T
the service instance
service
)

Get the source of the given service.

private static SpringFactoriesLoader
public Iterator<T>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

public Stream<T>

Returns:

a stream of the services
stream
()

Return a Stream of the AOT services.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

beansback to summary
private final Map<String, T> beans
FACTORIES_RESOURCE_LOCATIONback to summary
public static final String FACTORIES_RESOURCE_LOCATION

The location to look for AOT factories.

servicesback to summary
private final List<T> services
sourcesback to summary
private final Map<T, AotServices.Source> sources

Constructor Detail

AotServicesback to summary
private AotServices(List<T> loaded, Map<String, T> beans)

Method Detail

asListback to summary
public List<T> asList()

Return the AOT services as a List.

Returns:List<T>

a list of the services

collectServicesback to summary
private List<T> collectServices(List<T> loaded, Map<String, T> beans)
collectSourcesback to summary
private Map<T, AotServices.Source> collectSources(Collection<T> loaded, Collection<T> beans)
factoriesback to summary
public static AotServices.Loader factories()

Create a new Loader that will obtain AOT services from META-INF/spring/aot.factories.

Returns:AotServices.Loader

a new Loader instance

factoriesback to summary
public static AotServices.Loader factories(ClassLoader classLoader)

Create a new Loader that will obtain AOT services from META-INF/spring/aot.factories.

Parameters
classLoader:ClassLoader

the class loader used to load the factories resource

Returns:AotServices.Loader

a new Loader instance

factoriesback to summary
public static AotServices.Loader factories(SpringFactoriesLoader springFactoriesLoader)

Create a new Loader that will obtain AOT services from the given SpringFactoriesLoader.

Parameters
springFactoriesLoader:SpringFactoriesLoader

the spring factories loader

Returns:AotServices.Loader

a new Loader instance

factoriesAndBeansback to summary
public static AotServices.Loader factoriesAndBeans(ListableBeanFactory beanFactory)

Create a new Loader that will obtain AOT services from META-INF/spring/aot.factories as well as the given ListableBeanFactory.

Parameters
beanFactory:ListableBeanFactory

the bean factory

Returns:AotServices.Loader

a new Loader instance

factoriesAndBeansback to summary
public static AotServices.Loader factoriesAndBeans(SpringFactoriesLoader springFactoriesLoader, ListableBeanFactory beanFactory)

Create a new Loader that will obtain AOT services from the given SpringFactoriesLoader and ListableBeanFactory.

Parameters
springFactoriesLoader:SpringFactoriesLoader

the spring factories loader

beanFactory:ListableBeanFactory

the bean factory

Returns:AotServices.Loader

a new Loader instance

findByBeanNameback to summary
public T findByBeanName(String beanName)

Find the AOT service that was loaded for the given bean name.

Parameters
beanName:String

the bean name

Returns:T

the AOT service or null

Annotations
@Nullable
getSourceback to summary
public AotServices.Source getSource(T service)

Get the source of the given service.

Parameters
service:T

the service instance

Returns:AotServices.Source

the source of the service

getSpringFactoriesLoaderback to summary
private static SpringFactoriesLoader getSpringFactoriesLoader(ClassLoader classLoader)
iteratorback to summary
public Iterator<T> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<T>

an Iterator.

Annotations
@Override
streamback to summary
public Stream<T> stream()

Return a Stream of the AOT services.

Returns:Stream<T>

a stream of the services

org.springframework.beans.factory.aot back to summary

public Class AotServices.Loader

extends Object
Class Inheritance

Loader class used to actually load the services.

Field Summary

Modifier and TypeField and Description
private final ListableBeanFactory
private final SpringFactoriesLoader

Constructor Summary

AccessConstructor and Description
pack-priv
Loader(SpringFactoriesLoader springFactoriesLoader, ListableBeanFactory beanFactory)

Method Summary

Modifier and TypeMethod and Description
public <
the service type
T
>
AotServices<T>

Returns:

a new AotServices instance
load
(Class<T>
the service type
type
)

Load all AOT services of the given type.

private <T> Map<String, T>
loadBeans(Class<T> type)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

beanFactoryback to summary
private final ListableBeanFactory beanFactory
Annotations
@Nullable
springFactoriesLoaderback to summary
private final SpringFactoriesLoader springFactoriesLoader

Constructor Detail

Loaderback to summary
pack-priv Loader(SpringFactoriesLoader springFactoriesLoader, ListableBeanFactory beanFactory)

Method Detail

loadback to summary
public <T> AotServices<T> load(Class<T> type)

Load all AOT services of the given type.

Parameters
<T>
the service type
type:Class<T>

the service type

Returns:AotServices<T>

a new AotServices instance

loadBeansback to summary
private <T> Map<String, T> loadBeans(Class<T> type)
org.springframework.beans.factory.aot back to summary

public final Enum AotServices.Source

extends Enum<AotServices.Source>
Class Inheritance

Sources from which services were obtained.

Field Summary

Modifier and TypeField and Description
public static final AotServices.Source
BEAN_FACTORY

An AOT service loaded from a BeanFactory.

public static final AotServices.Source

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static AotServices.Source
public static AotServices.Source[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

BEAN_FACTORYback to summary
public static final AotServices.Source BEAN_FACTORY

An AOT service loaded from a BeanFactory.

SPRING_FACTORIES_LOADERback to summary
public static final AotServices.Source SPRING_FACTORIES_LOADER

An AOT service loaded from SpringFactoriesLoader.

Constructor Detail

Sourceback to summary
private Source()

Method Detail

valueOfback to summary
public static AotServices.Source valueOf(String name)
valuesback to summary
public static AotServices.Source[] values()