All language subtitles for 023 Bean Scopes - 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: Let's take care of our normal Housekeeping,

stopping all apps and closing all windows.

And in my file system here,

I'll just do a copy paste on this project.

O six lazy initialization

and I'll rename it as O seven bean scopes.

And then I'll go ahead and open this up in IntelliJ.

I'll do a rebuild on the project here

and I'll remove the lazy initialization

and I'll also remove the global configuration for lazy-init.

I'll open up the application properties here

and just remove that configuration.

And then I'll do a similar thing here on the track coach,

remove that lazy annotation.

And again, just cleaning up,

just so I have some basic code to start with.

All right, so let's go ahead

and move into our demo controller here

and let's add a new field.

I'll create this coach, another coach

and then I'll update my constructor to inject another coach.

Here I have qualifier and I have cricket coach

and then I have coach the another coach.

And then inside of this constructor here,

I make the appropriate assignments.

So I'll have another coach equals the another coach.

All right so that's our new constructor,

that has been updated here.

And again, a couple things to point out here.

The default scope is singleton,

so all dependency injections for the bean,

will reference the same bean.

Let's also add some code here at the bottom,

to check the bean scopes.

So I'll just stretch out here at the bottom,

give myself some room to work with.

I'll add this new get mapping slash check

and I'll return comparing beans.

And in parens, I'll give my coach,

equals equals another coach,

just to see if they point to the same thing.

Okay, so again, we're checking to see,

if this is the same beans.

So true or false, depending on the bean scope.

If it's singleton, it should return true,

prototype return false.

All righty, so we'll swing out here

and we'll go ahead and run this application.

Okay, so our application is up and running.

Open up our browser.

Just go to this local host 8080 slash check.

All righty, great.

So we're checking to see if this is the same bean.

By default we have singleton scope,

hence true, this kind of works out as desired.

Now let's swing back into our application code here.

And now what I wanna do is move over to the cricket coach

and change the bean scope to prototype.

I make use of the scope annotation

and then I choose scope of prototype.

Now remember with this prototype scope,

a new object instance is created for each injection.

And now swinging back over to the controller,

just as a refresh here with prototype scope,

new object instance for each injection.

And so out there we'll have two different objects,

that are injected and so they won't point to the same.

So this should return false for us.

So now browser, move over here and do a reload

and excellent false.

So again, we're checking to see if it's the same bean,

since we have prototype scope, hence false,

because we have two separate objects that were created

and it's not pointing to the exact same object.

All right, so this kind of works out as desired.

A good example here of using scopes,

the default singleton scope, and also the prototype scope.

So I'd 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.