interface ObjectProvider<T : Any> : ObjectFactory<T>
A variant of ObjectFactory designed specifically for injection points, allowing for programmatic optionality and lenient not-unique handling.
Author
Juergen Hoeller
Since
4.3
abstract fun getIfAvailable(): Topen fun getIfAvailable(defaultSupplier: Supplier<T>): T
Return an instance (possibly shared or independent) of the object managed by this factory. |
|
abstract fun getIfUnique(): Topen fun getIfUnique(defaultSupplier: Supplier<T>): T
Return an instance (possibly shared or independent) of the object managed by this factory. |
|
abstract fun getObject(vararg args: Any): T
Return an instance (possibly shared or independent) of the object managed by this factory. Allows for specifying explicit construction arguments, along the lines of |
|
open fun ifAvailable(dependencyConsumer: Consumer<T>): Unit
Consume an instance (possibly shared or independent) of the object managed by this factory, if available. |
|
open fun ifUnique(dependencyConsumer: Consumer<T>): Unit
Consume an instance (possibly shared or independent) of the object managed by this factory, if unique. |