"스프링 BeanFactory 컨테이너"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-==참고 자료== +==참고==))
잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
8번째 줄: 8번째 줄:
*org.springframework.beans.factory.BeanFactory 인터페이스로 정의됨
*org.springframework.beans.factory.BeanFactory 인터페이스로 정의됨


<source lang='java'>
<syntaxhighlight lang='java'>
Resource res = new FileSystemResource("beans.xml");
Resource res = new FileSystemResource("beans.xml");
XmlBeanFactory factory = new XmlBeanFactory(res);
XmlBeanFactory factory = new XmlBeanFactory(res);
</source>
</syntaxhighlight>
<source lang='java'>
<syntaxhighlight lang='java'>
ClassPathResource res = new ClassPathResource("beans.xml");
ClassPathResource res = new ClassPathResource("beans.xml");
XmlBeanFactory factory = new XmlBeanFactory(res);
XmlBeanFactory factory = new XmlBeanFactory(res);
</source>
</syntaxhighlight>
<source lang='java'>
<syntaxhighlight lang='java'>
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(
         new String[] {"applicationContext.xml", "applicationContext-part2.xml"});
         new String[] {"applicationContext.xml", "applicationContext-part2.xml"});
// of course, an ApplicationContext is just a BeanFactory
// of course, an ApplicationContext is just a BeanFactory
BeanFactory factory = (BeanFactory) appContext;
BeanFactory factory = (BeanFactory) appContext;
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 02:50 기준 최신판

1 개요[ | ]

Spring BeanFactory Container
스프링 BeanFactory 컨테이너
  • 스프링 IoC 컨테이너의 일종
  • 의존성 주입(DI)을 지원하는 컨테이너
  • 빈의 제어(생성·관계설정 등)를 담당하는 IoC 오브젝트
  • 인스턴스를 생성하고 설정하고 bean들을 관리하는 컨테이너
  • org.springframework.beans.factory.BeanFactory 인터페이스로 정의됨
Resource res = new FileSystemResource("beans.xml");
XmlBeanFactory factory = new XmlBeanFactory(res);
ClassPathResource res = new ClassPathResource("beans.xml");
XmlBeanFactory factory = new XmlBeanFactory(res);
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(
        new String[] {"applicationContext.xml", "applicationContext-part2.xml"});
// of course, an ApplicationContext is just a BeanFactory
BeanFactory factory = (BeanFactory) appContext;

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}