# IoC Container - Inversion of Control Pattern - Dependency Injection Pattern - 전략 패턴(Strategy Pattern): 바꾸기 쉬운 구조 - `org.springframework.beans`, `org.springframework.context` 패키지 ## Mechanism Spring IoC container - Config metadata + POJO = executable app ## Bean Factory - `BeanFactory` - `ApplicationContext` ```java public static void main(String[] args) { // BeanFactory Resource r = new ClassPathResource("applicationContext.xml"); BeanFactory factory = new XmlBeanFactory(r); Employee e1 = (Employee) factory.getBean("e1"); e1.show(); // ApplicationContext ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); Employee e2 = (Employee) context.getBean("e1"); e2.show(); } ``` ```xml ``` ## ref - https://www.javatpoint.com/ioc-container