Complete Spring 7 & Spring Boot 4 course from beginner to Advance using first thought principle.
Curated by: Coder Army (29 videos)
In this video, we will understand the complete Spring Bean Lifecycle from first principles. When we create objects manually in Java, we are responsible for object creation, dependency setup, method calls, and cleanup. But in Spring, the IoC Container takes responsibility for managing objects, and these Spring-managed objects are called beans. In this lecture, we will understand how a bean travels through its complete lifecycle inside the Spring container — from bean definition reading to object creation, dependency injection, initialization, usage, and destruction. Topics covered in this video: * What is Spring Bean Lifecycle? * What is a BeanDefinition? * How Spring reads configuration and annotations * Difference between instantiation and initialization * Dependency Injection in bean lifecycle * Constructor injection, setter injection, and field injection * Aware interfaces in Spring * BeanNameAware and ApplicationContextAware * BeanPostProcessor before and after initialization * Initialization callbacks in Spring * @PostConstruct explained * InitializingBean explained * Custom initMethod explained * Destruction callbacks in Spring * @PreDestroy explained * DisposableBean explained * Custom destroyMethod explained * Singleton bean lifecycle * Prototype bean lifecycle * Why @PreDestroy does not run automatically for prototype beans * Singleton bean depending on prototype bean * @Lazy and bean lifecycle * Can @PostConstruct solve circular dependency? By the end of this video, you will clearly understand how Spring creates, prepares, manages, and destroys beans internally. This topic is extremely important before moving deeper into Spring Framework, Spring MVC, Spring Boot, and real backend development because almost everything in Spring is built around the IoC Container and bean management. If you are learning Spring Framework from scratch, this video will help you understand what actually happens behind the scenes when Spring manages your application objects. JAVA Beginner to Advance Series : https://youtube.com/playlist?list=PLQEaRBV9gAFsR15tNo2QLF9d2qc-c018p&si=lNuF5lyt4nKz9Up7 Join System Design WhatsApp Group: https://www.whatsapp.com/channel/0029VbBF1XKF1YlMyYuPM23s Code and Notes: Github : https://github.com/adityatandon15/Spring-Framework-Full-Course We have paid courses on DSA, Web Development , Blockchain, System Design & GenAI. Join Courses: https://strikes.in/ Coder Army Website: https://coderarmy.in/#home Coder Army App: https://play.google.com/store/apps/details?id=com.rohit.negi Connect with Aditya Tandon Instagram : https://www.instagram.com/adityatandon2 LinkedIn : https://www.linkedin.com/in/adityatandon2 Twitter : https://x.com/adityatandon02 Timestamps: 00:00 Intro 09:24 Bean LifeCycle 16:48 Bean Definitions 20:12 Instatntiating Objects 22:51 Dependency Injections 26:14 Aware Interfaces 41:14 Initialization Callbacks 46:58 InitializingBean 52:33 init Method 55:15 @PostConstruct Annotation 01:01:23 Why not use constructors instead of PostConstruct 01:04:02 Using the Beans 01:05:15 Destruction Callbacks 01:06:28 DisposableBean 01:10:21 destroyMethod 01:11:36 @PreDestroy Annotation 01:13:39 Bean is destroyed 01:14:37 @Lazy and Prototype lifecycle 01:22:25 Solving Circular Dependency using @PostConstruct #SpringFramework #SpringCore #SpringBoot #JavaBackend #SpringBeanLifecycle