Section 2 Module 4 Part 1: Spring Dependency Injection & Auto-wiring

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

this is the cleanest explanation on youtube

DoctorOwnPoolman
Автор

So the Beans are java objects that are created when the DispatcherServlet launched? Do they live through out the application? Or could they be eligible for garbage collection?

thinkingaloud
Автор

Two quick questions:

Q1. In this example, does the VideoConf class implement the StorageSystem interface?

Q2. At what point in this flow is it determined whether LocalStorage is instantiated, or if AmazonS3Storage is instantiated and assigned to the storage variable?

AmmarRai
Автор

Cool, a really good explanation, we can use more annotations like @Qualifier to avoid the use of config class, but i think these annotations are from Spring 4

samueldiaz
Автор

Q3. You said that everytime VideoService is instantiated, Spring looks through our @Configuration class to find an implementation of StorageSystem, and sets storage to that value. However, you later said that on runtime, the VideoConf class is instantiated, and an instance of LocalStorage is automatically created, which is then inserted into its complimentary @Autowired variables. Which happens first? Is our @Configuration instantiated and the @Bean instances created... or... does this happen only at the request of the @Controller class being instantiated, and Spring sees a variable waiting to be assigned with the @Autowired annotation?

AmmarRai