![]() ![]() The example below demonstrates the working of these annotations. ![]() The CommonAnnotationBeanPostProcessor in Spring is responsible for the recognition of these lifecycle annotations. ![]() The JSR-250 specification provides 2 annotations, and If you want logic to be executed before the bean is ready to use by the programs, use Similarly, if you want the callback to be executed before the bean gets destroyed, use These annotations are used on the method level. If you are using JDK 9 or higher, please make sure you add the javax.annotation-api dependency for JSR-250 to work. It is recommended to use JSR-250 and annotations as a best practice for executing lifecycle callbacks in a Spring application.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |