─━ IT ━─/스프링

[스프링] BeanFactory

DKel 2016. 10. 24. 17:05
반응형

* 빈 객체를 관리하고 각 빈 객체간의 의존 관계를 설정해 주는 기능을 제공하는 가장 단순한 컨테이너

* 구현 클래스 : org.springframework.beans.factory.xml.XmlBeanFactory

* XmlBeanFactory는 외부 자원으로부터 설정 정보를 읽어 와 빈 객체를 생성 (ex. xml파일)

* org.springframework.core.io.Resource 인터페이스를 사용하여 다양한 종류의 자원을 동일한 방식으로 표현할 수 있음.

 

 

 Resource resource = new FileSystemResource("beans.xml");

 XmlBeanFactory factory = new XmlBeanFactory(resource);

 AgentService agent = (AgentService)factory.getBean("agent");

[출처] [스프링] BeanFactory|작성자 Dreamy

 

 

반응형