Interface BeanFactory<T>
- Type Parameters:
T- The type of bean this factory creates.
- All Known Implementing Classes:
BeanFactory.Void
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
This interface provides a single DI hook for all framework-managed classes including
BeanConsumer, BeanSupplier, BeanChannel, ObjectSwap subclasses,
and any ordinary bean class parsed from JSON/XML/etc.
When a class annotated with
- Look up the factory class in the
BeanStore(e.g. SpringApplicationContext) - If not found in the store, attempt to instantiate the factory directly via no-arg constructor
or
getInstance()static method - If both fail, throw
IllegalArgumentException
Example (Spring integration):
See Also:
BeanConsumer- Parse-only lifecycle interfaceBeanSupplier- Serialize-only lifecycle interfaceBeanChannel- Round-trip lifecycle interface- Marshalling
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classSentinel class used as the default value for@BeanType(factory=...)and@BeanProp(factory=...)when no factory is specified. -
Method Summary
-
Method Details
-
create
Creates a new instance of the bean.- Returns:
- A new bean instance.
- Throws:
Exception- If the bean cannot be created.
-