Interface ComponentLifecycleHandler<C>
- Type Parameters:
C- The type of component.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents a handler for a component's lifecycle.
Unlike the LifecycleHandler, this handler provides access to the component when it is created.
With decorated components, this may not be the same component instance as would be retrieved from the configuration
using the component's identifier. The latter would return the decorated component, while the
ComponentLifecycleHandler receives the instance on the level it was registered. If this is a decorator, you
get the decorated instance of that registration, not the completed component.
- Since:
- 5.0.0
- Author:
- Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptionrun(Configuration configuration, C component) Runs the lifecycle handler for givencomponentthat has been defined within the scope of givenconfiguration.
-
Method Details
-
run
Runs the lifecycle handler for givencomponentthat has been defined within the scope of givenconfiguration. The configuration may be used to retrieve components that the given component must interact with during its lifecycle.Lifecycle methods may be executed asynchronously. In that case, the returned
CompletableFuturemust be completed when the lifecycle operation has completed. Failures may be propagated by completing theCompletableFutureexceptionally.- Parameters:
configuration- The configuration in which the component was defined.component- The instance of the component.- Returns:
- A future that completes when the lifecycle operation has terminated.
-