Learn about the Singleton pattern from a conceptual level in this video.
- The singleton pattern is the one pattern that I use … almost as much as the factory pattern … and with Spring I'm using that a lot more than I usually had … because everything in Spring is a singleton. … Well almost everything. … So in Spring itself, every bean by default is a singleton. … Unless you tell the application context otherwise, … you're going to get a singleton. … Now one thing to note is that this is not … a classic singleton which is what we're going to discuss, … but it behaves the exact same during … the run time of your application. … Beans, therefore, because they are singletons … must be designed in a way that is thread safe. … And that applies to all singleton classes in general. … So this pattern is relatively straightforward. … You have a class that stores a reference to itself. … More specifically, to an instance of itself. … You have a private constructor. … Then you have a static getInstance method … that returns a reference of self or if self is nul, … it constructs it using the private constructor …
AuthorFrank P Moley III
- The patterns of the Spring framework
- Creational patterns in Spring
- The adapter and decorator pattern in action
- Structural patterns in Spring
- The repository pattern in action
- The observer, command, and mediator patterns
Skill Level Intermediate
What you should know1m 28s
1. Design Patterns and Spring
2. Creational Patterns in Spring
3. Structural Patterns in Spring
4. Operational Patterns in Spring
5. Other Framework Patterns in Spring
Next steps3m 27s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.