All language subtitles for 025 Bean Lifecycle Methods - Coding_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Instructor: All righty, let's get started.

So we'll do our normal housekeeping work.

And let's move in here to our file system

and we'll copy this directory, 07-bean-scopes,

and we'll paste it and we'll give it a new name.

And the new name we'll give it is 08-bean-lifecycle-methods.

And let's go ahead and open this project in IntelliJ.

And one thing I'd like to do here is just some cleanup work.

I'd like to change the code to inject only one coach

and to use singleton scope.

Just want to kind of keep it simple.

Give me some good baseline code to work with.

I'll move into the DemoController,

expand my window here for a second,

and I'll remove one of the coaches here.

So I'll remove this anotherCoach field.

And then I'll also move down here

and remove the qualifier for theAnotherCoach.

And fix the curly brace here.

Remove this line with the assignment.

And so this is kind of what my constructor should look like

for the DemoController.

And then this GetMapping for check,

we'll go ahead and delete this section of code also.

All right, so this is basically what our application

should look like or our coach should look like

at this point.

And then I'd also like to go over

and make the change here to CricketCoach.

And so I want to remove the prototype scope.

So I'll just delete this Scope annotation here.

All righty. So this looks pretty good.

And then we can kind of get down to business here.

So step one of defining the methods for init and destroy,

and then adding the annotations here

for @PostConstruct and @PreDestroy.

I'll just write some quick comments here to myself

just to kind of keep myself on track.

Okay, this is our basic game plan here

defining our init method

and also defining our destroy method.

So I'll start here with the init method

and I'll make use of the annotation PostConstruct.

I give a method here, doMyStartupStuff.

Again, you can use any method name here that you want.

And then I'll just do a little print line statement here

just to let them know that hey,

we're in doStartupStuff for a given class.

Alrighty, this looks pretty good for our PostConstruct.

So this is our init method.

Let's kind of copy-paste this

and let's do a similar thing here for PreDestroy.

So I'll just paste it.

I'll update the annotation PreDestroy.

And then I'll just move down here

and just give it a new method name, doMyCleanupStuff.

Let's update our print line accordingly.

And that's the coding there for our destroy method.

It looks good. I like it.

Now let's go ahead and test this out.

Let's just run our application.

Our app is up and running.

And one thing to notice here,

we see the code or the execution of our init method here.

So in doMyStartupStuff for CricketCoach.

So notice the previous line,

we're in the constructor for CricketCoach

and then we have our custom init method that runs

as a PostConstruct.

So this is great. I like it.

Now if I stop the application,

then we should execute our PreDestroy method.

So we're gonna just stop, scroll down a bit,

and then we'll see that this print line here

in doMyCleanupStuff.

So this code is actually executing as desired.

So this was great. I like it.

Good job.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.