- Mastering Spring 5.0
- Ranga Rao Karanam
- 151字
- 2021-07-02 22:12:03
The Spring IoC container
The Spring IoC container creates the beans and wires them together according to the configuration setup created by the application developer.
The following questions need to be answered:
- Question 1: How does the Spring IoC container know which beans to create? Specifically, how does the Spring IoC container know to create beans for the BusinessServiceImpl and DataServiceImpl classes?
- Question 2: How does the Spring IoC container know how to wire beans together? Specifically, how does the Spring IoC container know to inject the instance of the DataServiceImpl class into the BusinessServiceImpl class?
- Question 3: How does the Spring IoC container know where to search for beans? It is not efficient to search all packages in the classpath.
Before we can focus on creating a container, let's focus on questions 1 and 2; how to define what beans need to be created and how to wire them together.