public interface ContainerLifecycleProcessor extends Sorted
ContainerDefinition,
ContainerManager| 限定符和类型 | 方法和说明 |
|---|---|
default @Nullable Container<Object> |
whenCreated(ContainerDefinition definition,
Container<Object> container)
Callback methods when the container is instantiated based on the
ContainerDefinition. |
default void |
whenDestroyed(Object target)
Callback methods when the container comparator is removed from the
ContainerManager. |
default ContainerDefinition |
whenRegistered(@Nullable Object old,
ContainerDefinition newDefinition)
Callback methods when the container is registered with the
ContainerManager. |
default ContainerDefinition whenRegistered(@Nullable Object old, ContainerDefinition newDefinition)
Callback methods when the container is registered with the ContainerManager.
At this stage, you can modify the container's definition information,
including but not limited to modifying its loading strategy or replacing its factory method.
old - old container instance or container definitionnewDefinition - new definition of containerContainerManager.registerContainer(cn.crane4j.core.container.ContainerDefinition)default @Nullable Container<Object> whenCreated(ContainerDefinition definition, Container<Object> container)
Callback methods when the container is instantiated based on the ContainerDefinition.
At this stage, you can modify the container's definition information
or perform initialization or other modifications on the created container instance.
definition - definition of container, if create by ContainerProvider, definition is nullcontainer - containerContainerManager.getContainer(java.lang.String)default void whenDestroyed(Object target)
Callback methods when the container comparator is removed from the ContainerManager.
At this stage, you can perform some final operations
on the container definition or container comparator, such as clearing data caches.
target - container comparator or container definitionContainerManager.clear()Copyright © 2024. All rights reserved.