At this point, it is clear already how beans are instantiated inside Spring 5.0 containers. The practical definition of Inversion of Control and Dependency Injection design patterns has been established too. Two approaches to implementing a container have been illustrated with the previous recipes. This time we will provide a recipe on how to decide what form of instantiation the beans must undergo in a container.
We need both ch02-xml
and ch02-jc
in this recipe since the bean loading strategy depends on what type of ApplicationContext
container is being used. There are two bean loading strategies in the Spring 5.0 framework namely eager and lazy loading.