From the course: Spring: Design Patterns
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Prototype pattern in action
- [Instructor] So now that we've talked a little bit about the prototype pattern I want to show you how it's used in the Spring Framework as opposed to the Java Framework this time. So let's jump into our IDE and just like we've done a couple times before let's create a new package in our base package And this time we're going to call it Prototype. Now we're going to create two very dumb classes here and the first we're going to call ProtoTrue and the second we're going to call ProtoFalse Now we're not going to do anything with either one of these classes as far as implementation. What we are going to do is jump into the Design Patterns App application. Alright, so in this class we're going to create a Bean. Public ProtoFalse and we'll simply call it that and we will return a new ProtoFalse object. Now we're going to do another Bean and this time we're going to set it Scope to be equal to prototype. Now we're going to do a public ProtoTrue and we will return a new ProtoTrue. Now, in…
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
-
-
-
-
The Factory pattern4m 39s
-
(Locked)
Factory pattern in action5m 38s
-
(Locked)
The Builder pattern2m 55s
-
(Locked)
Builder pattern in action6m 1s
-
(Locked)
The Singleton pattern4m 1s
-
(Locked)
Singleton pattern in action4m 55s
-
(Locked)
The Prototype pattern4m 36s
-
(Locked)
Prototype pattern in action4m 59s
-
-
-
-
-