public interface BootstrapContext
Environment
post-processing up to the point that the ApplicationContext
is prepared.
Provides lazy access to singletons that may be expensive to create, or need to be
shared before the ApplicationContext
is available.
Modifier and Type | Method and Description |
---|---|
<T> T |
get(java.lang.Class<T> type)
Return an instance from the context if the type has been registered.
|
<T> T |
getOrElse(java.lang.Class<T> type,
T other)
Return an instance from the context if the type has been registered.
|
<T> T |
getOrElseSupply(java.lang.Class<T> type,
java.util.function.Supplier<T> other)
Return an instance from the context if the type has been registered.
|
<T,X extends java.lang.Throwable> |
getOrElseThrow(java.lang.Class<T> type,
java.util.function.Supplier<? extends X> exceptionSupplier)
Return an instance from the context if the type has been registered.
|
<T> boolean |
isRegistered(java.lang.Class<T> type)
Return if a registration exists for the given type.
|
<T> T get(java.lang.Class<T> type) throws java.lang.IllegalStateException
T
- the instance typetype
- the instance typejava.lang.IllegalStateException
- if the type has not been registered<T> T getOrElse(java.lang.Class<T> type, T other)
T
- the instance typetype
- the instance typeother
- the instance to use if the type has not been registered<T> T getOrElseSupply(java.lang.Class<T> type, java.util.function.Supplier<T> other)
T
- the instance typetype
- the instance typeother
- a supplier for the instance to use if the type has not been registered<T,X extends java.lang.Throwable> T getOrElseThrow(java.lang.Class<T> type, java.util.function.Supplier<? extends X> exceptionSupplier) throws X extends java.lang.Throwable
T
- the instance typeX
- the exception to throw if the type is not registeredtype
- the instance typeexceptionSupplier
- the supplier which will return the exception to be thrownX
- if the type has not been registeredjava.lang.IllegalStateException
- if the type has not been registeredX extends java.lang.Throwable
<T> boolean isRegistered(java.lang.Class<T> type)
T
- the instance typetype
- the instance typetrue
if the type has already been registered