Reputation: 45702
In Spring docummentation mentioned many lifecycle steps: both for container and bean (see pictures below). But when I started to look for annotations (interfaces to implement) I couldn't find anything except of:
If I correctly understand those pictures, I can use:
BPP
calback of Container lifecycle
via custom realization of BeanPostProcessor
.init-method
and destroy
calbacks from bean lifecycle
.Questions:
If I can use only 3 callbacks of container and bean lifecycle.. What is the information below for? I mean why I should know all those lifecycle steps if I can't profit from them. May be I forgot some callbacks that I can use?
Container lifecycle:
Bean lyfecycle:
Upvotes: 0
Views: 392
Reputation: 8926
I think you missed all the *Aware
intefaces, which are mentioned in the diagram (mainly from org.springframework.beans.factory
package):
Whenever your bean implements one of those interfaces, Spring will call their methods at corresponding lifecycle step.
Upvotes: 2