A lifecycle hook interface for customizing the PodFactory before it is fully initialized or configured within the Jetleaf framework.
Introduced in Jetleaf v1.0.1, this interface allows advanced users or framework extensions to programmatically modify a ConfigurablePodFactory instance prior to pod registration, scanning, or dependency resolution.
This customization stage occurs very early in the application startup lifecycle — before any pods are instantiated or dependency lookups are available. Therefore, performing lookups or depending on the existence of other pods at this stage will result in errors.
Implementations of PodFactoryCustomizer are typically used to:
- Register custom pods or modify existing pod definitions before they are loaded.
- Replace or enhance pod definitions, such as swapping out default implementations or adding new configuration metadata.
- Adjust factory settings like scope strategies, naming conventions, or default initialization behaviors.
Usage Notes
- This interface should be implemented by components that participate in the bootstrap process of Jetleaf.
- Class must have a no-arg constructor, else, it will be ignored.
- Avoid using any form of dependency lookup (
get(),containsType(), etc.) inside customize; the pod registry is not yet available. - Use this hook for explicit registrations only — such as adding new pod definitions or altering the configuration of the factory itself.
Example
final class CustomPodRegistrar implements PodFactoryCustomizer<ConfigurablePodFactory> {
@override
Future<void> customize(ConfigurablePodFactory podFactory) async {
// Register a custom service pod before initialization
podFactory.registerPodDefinition(
PodDefinition.ofType(MyCustomService),
);
}
}
This ensures that your custom service is known to the factory before the main application context begins initialization.
- Annotations
-
- @Generic(PodFactoryCustomizer)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
customize(
T podFactory, Environment environment) → Future< void> -
Customizes the given
podFactorybefore it is initialized. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited