From the course: Spring: Framework in Depth
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Init: Setters
- [Instructor] So after objects are constructed, we can now call setters on them, and that is what the Spring framework does next. So again, back to where we are. So we've instantiated our beans, and now we're ready to do setter calling. So, post-initialization dependency injection should only be done on optional beans or dynamic beans, and that's really important to remember that concept. Anything that is required for your class to operate should have been injected via a constructor. Now there's no way for the application context in the IOC container to know which is which. This is is just good development practice. So after all beans have been instantiated, we can go through and call the setter on each object, which, go back to object-orient programming and working with Java, right, you have to construct the object to call any methods on it including setters. Autowiring will occur here on all methods that are not…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Why the lifecycle is so important3m 38s
-
The overall picture2m 25s
-
(Locked)
The init phase: Loading bean definitions2m 54s
-
(Locked)
Init: Bean factory post-processing3m 55s
-
(Locked)
Init: Bean instantiation3m
-
(Locked)
Init: Setters1m 54s
-
(Locked)
Init: Bean post-processing3m 25s
-
(Locked)
Init: Differences based on configuration2m 49s
-
(Locked)
The use phase1m 56s
-
(Locked)
The destruction phase2m 6s
-
(Locked)
-
-