All language subtitles for 021 Lazy Initialization - Coding - Part 2_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: Now we can go ahead

and start our application and test it out.

And when we look at the logs here

we can see that we have all

of these constructor print line statements here

for baseball coach, cricket coach, and so on.

So notice here all the beans are created

at application startup.

Now let's go ahead and mark the track coach as lazy.

I'll open up my track coach implementation here

and I'll simply annotate it with the lazy annotation.

Alrighty and so now when we run our application again

we should see this output here baseball coach,

cricket coach, tennis coach.

And notice since we're not injecting the track coach

it is not initialized, it's lazy.

That's the person that says,

Hey call me only if you really need me.

If you don't need me I'm not gonna just show up

and do nothing.

All right, great. So that's how lazy works out.

Now let's go ahead and set up lazy initialization

on a global scale or global configuration here

and we can set that up in our application.properties file.

And let me kind of zoom in here for a second

and I'll give the actual property

spring.main.lazy initialization equals true.

And remember that all beans are lazy.

No beans are created until needed

including our demo controller.

Now let's zoom out here and let's go ahead

and run our application and test it out.

And then our application is up and running.

Notice there were no log statements or print line statements

for any of our beans because they weren't constructed yet

or needed.

They're all lazy, including our demo controller.

Now if we go ahead and hit this endpoint

then it's actually gonna reference our demo controller

and also its dependencies accordingly.

So swinging back over here into our IDE

and looking at the logs,

we see that we're in constructor for cricket coach

and also in constructor for demo controller.

So for dependency resolution, spring creates an instance

of the cricket coach first, then it creates an instance

of the demo controller and injects that cricket coach.

Alrighty, so now you kinda see how the lazy initialization

works out and also kinda how spring is doing some

of the work behind the scenes.

All righty, so that's how it all works out.

This looks really good and I'm happy.

I like to say good job my friend.

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