-->

Sunday, June 2, 2019

Spring Core Containers and Dependency Injection

Java classes should be as independent as possible from each other.


  • To decouple classes from one another, dependencies should be injected through Constructors and Setters.
  • Classes should not configure themselves. IoC uses dependency injection to: 
    • Configure a class correctlyi from outside the class
    • Wire services or components.
  • Piecing together all the beans in the Spring Container is called Wiring.
    • This can most commonly be don through xml.
    • Various BeanFactories and ApplicationContext objects that support wiring include:
      • XMLBeanFactory
      • ClassPathXMLApplicationContext
      • FileSystemXMLApplicationContext
      • XMLWebApplicationContext

No comments:

Post a Comment