All language subtitles for 029 Java Config Bean - 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

-: All right, so now we'll move in here

and we'll make use of our alternate solution.

So the first step here is the Create a Configuration class.

And what I'll do is I'll first-off put this

in a separate package,

so I'll create this new package called Config.

So in the spring core demo, I'll have this new package

and it's, dot config.

All right, so I have this config package,

now let's go ahead

and create this new class called SportConfig.

Okay, so we have our Sport Config.

Now it could be in any package, it could be any class name

but I just like to use the word config because,

well, it kinda makes sense, it's a config.

I'll make use of this annotation here, Configuration,

and be sure to choose the annotation Configuration,

not Configurable, okay?

Configuration, as you see here on the screen.

And then we'll cover Step 2 of Defining a Bean method

to configure the bean.

I'll make use of this Bean annotation

and I'll create this method, public Coach, swimCoach.

It's gonna return an instance of a SwimCoach,

so, new SwimCoach.

And we're manually handling the construction here

for this given coach.

And then remember, the bean id defaults to the method name,

so the bean id in this example is swimCoach,

with a lowercase s.

And we can use that

when we inject it into our controller.

Alrighty, so kind of zooming out here for a bit,

and we're okay now, we can go ahead

and run this application.

And then, success!

Notice here, our diagnostics printed out,

In constructor for SwimCoach,

so hey, it's actually creating in a swim coach

and making it available

and the application started up successfully

so nothing failed.

So this is also good.

So that SwimCoach was injected into our Controller.

And then we can verify this by swinging

over to our web browser and then going

to localhost:8080/daily workout,

and "Swim 1000 meters as a warm up".

So that comes from our actual swim coach,

based on its configuration.

So, remember SwimCoach did not have the Component annotation

and it failed the first time we ran it.

And then we simply configured this as a Spring bean

using the Bean annotation,

and then everything worked out for us.

All right, so this is more of a contrived example,

but from that real world example I gave you a little earlier

the whole idea of making use of the Bean annotation is

to take an existing third-party class

and then wrap it and expose it as a bean

that we can use in our Spring applications.

All right, so I'm not done.

Let's play around with one more thing here.

Let's swing back into our code

and now let's give our bean a custom id,

so instead of using whatever the method name is,

let's give it a custom Bean id, and we can do that

by simply providing a string here for this bean annotation

and I'll call this bean, aquatic.

Just making something up here.

So that's the bean id that we can use.

We can swing back over into our controller

and then we can inject that given bean id.

So we make use of our custom bean id of, aquatic.

All righty, everything should kind of reload there for us.

And now if I swing back over to my browser

and do a reload, then everything still works as desired.

So we're still injecting that swim coach

and we can still make use of them.

So, this is great. I'm happy.

I like it.

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