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
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.