In the Blueprint programming model, a bean manager can manage the life cycle of the object that it creates. The bean manager can notify an object after all properties are injected, or when an object instance is destroyed.
The destroy-method callback is not supported for beans with a scope of prototype. In this situation, the application is responsible for destroying those instances.
The following code examples show an example of a Java™ class with lifecycle methods and a Blueprint XML bean entry that specifies the init-method and destroy-method attributes.
public class Account {
public Account(long number) {
...
}
public void init() {
...
}
public void destroy() {
...
}
}
<bean id=”accountFour” class=“org.apache.aries.simple.Account”
init-method=”init” destroy-method=”destroy”>
<argument value=”6”/>
<property name=”description” value=”#6 account”/>
</bean>