public interface ManagedLifeCycle extends ManagedPostConstruct, ManagedPreDestroy
ManagedPostConstruct, respective ManagedPreDestroy. This interface
only adds automatic creation at container start.
To benefit from managed life cycle a class should implement this interface, as in sample code below.
class DemoClass implements ManagedLifeCycle
{
void postConstruct() ...
void preDestroy() ...
}
Managed life cycle interface can be used on class implementation, as in example above or can be extended by class interface, like below:
class DemoInterface extends ManagedLifeCycle
{
}
class DemoClass implements DemoInterface
{
void postConstruct() ...
void preDestroy() ...
}
| Modifier and Type | Method and Description |
|---|---|
void |
postConstruct()
Hook executed after class instance was created and initialized.
|
void |
preDestroy()
Hook executed just before managed class instance destruction.
|
void postConstruct()
throws Exception
postConstruct in interface ManagedPostConstructException - bubble-up any exception post-construct logic may rise.void preDestroy()
throws Exception
preDestroy in interface ManagedPreDestroyException - propagate any exception pre-destroy logic may rise.Copyright © 2018. All rights reserved.