Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
1 1
Alright, so let's go ahead 2
2
and move into Eclipse and let's write some code. 3
3
With our development process, the first thing 4
4
we need to do is create a setter 5
5
method in our class for injections. 6
6
But, actually, what we need to do 7
7
really is create a new class first. 8
8
Let's go ahead and create our CricketCoach class 9
9
and the name of this class, we'll call it, CricketCoach, 10
10
pretty simple and for the interfaces here, 11
11
I actually need to make use of the coach interface, 12
12
I need to add the coach interface, 13
13
I'll click on add, I'll type in coach at the top 14
14
and this will give me my coach interface. 15
15
Hit okay. 16
16
Alright, so now we have this coach interface listed 17
17
and we'll keep all the other 18
18
defaults and then we'll hit finish. 19
19
Okay great, so we have our very basic cricket coach class 20
20
and what I wanna do is, go ahead 21
21
and just do some of the basic work for these 22
22
methods that we need, get daily work out 23
23
and get daily fortune, so let me just kinda 24
24
clean this up a bit, let me add the 25
25
daily work out here for cricket 26
26
and so, here we're gonna practice fast bowling 27
27
for 15 minutes a day and cricket's a great sport. 28
28
Also, we're gonna get the daily fortune 29
29
and remember with this one, we need a helper 30
30
so we need to make use of our dependency here, 31
31
so private fortune service, and I'll just say, 32
32
fortune service, it hasn't been assigned yet 33
33
but we'll take care of that in a second. 34
34
But let's just go ahead and use it down here 35
35
in this get daily fortune method, 36
36
so here we'll say, return fortuneService.getFortune 37
37
and there we go. 38
38
Alright, so this kinda covers just the basic 39
39
infrastructure work that we needed 40
40
for a new coach that we're bringing online, 41
41
returning the daily work and 42
42
also returning the daily fortune. 43
43
Alright, so that takes care of that part of it. 44
44
Now, the next thing I need to do here, 45
45
is actually create a no argument constructor 46
46
because spring's gonna actually call this constructor 47
47
when they make a reference to our bean. 48
48
So again, constructor simply has the same name as the class, 49
49
public cricket coach and what I'll do 50
50
inside of this method here, or this constructor, 51
51
is I'll actually make use of a sys out print line, 52
52
I just wanna put a little diagnostic messaging here, 53
53
just so I know that, hey, we're actually inside 54
54
of our constructor because, when I run the program, 55
55
I like to see, kinda what's going on 56
56
behind the scenes by spring, so spring is gonna call this 57
57
method, or call this constructor 58
58
and I just wanna get some diagnostics 59
59
just so I know that, hey, things are happening for us. 60
60
Okay now, we can get to our real step one, 61
61
we have to do some preliminary work, 62
62
but we're ready to go now, so here, 63
63
this is why we actually create the 64
64
setter method in our class for the injections 65
65
and I'll make use of this Eclipse trick, 66
66
I'll just do a right click, I'll choose, source 67
67
and I'll go down to generate getters and setters. 68
68
In this scenario, I really only need a setter, 69
69
so I'll simply expand this list here 70
70
and I'll just check the box for, setFortuneService, 71
71
that's the only method that I need, 72
72
I don't really need the getter method, 73
73
only the setter method. 74
74
You can add the getter if you'd like, but it's not required. 75
75
Alright, so I'll go ahead and hit okay 76
76
and that should create a new method for me 77
77
and it's down there, let me just clear up some white space, 78
78
more white space and here it is, 79
79
in lines 12 through 14, that's that new setter method 80
80
that was just created for us by Eclipse 81
81
and this is the actual setter method 82
82
that'll be called by spring when they 83
83
actually inject the dependency. 84
84
Alright, so this looks pretty good so far, 85
85
I'll just copy paste this print line 86
86
onto a similar thing here in the setter method, 87
87
so another, just a diagnostic method 88
88
to say, "hey, I'm inside of this setter method." 89
89
when I give the actual method name. 90
90
Again, mainly just for us when we test the program out, 91
91
just to see what's going on. 92
92
Alright, so we can kinda step back a bit 93
93
and this is basically all the real stuff here, 94
94
we created that no argument constructor 95
95
and we also created our setter method. 96
96
So, we're in pretty good shape so far. 97
97
I'll see you in the next video.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.