2008. 1. 27.

스트링프레임워크 빈팩토리 생성하는 법

예제 1.
InputStream is = new FileInputStream("beans.xml");
BeanFactory factory = new XmlBeanFactory(is);

예제 2.
Resource resource = new FileSystemResource("beans.xml");
BeanFactory factory = new XmlBeanFactory(resource);

예제 3.
ClassPathResource resource = new ClassPathResource("beans.xml");
BeanFactory factory = new XmlBeanFactory(resource);

예제 4.
ApplicationContext context = new ClassPathXmlApplicationContext(
new String[] {"applicationContext.xml", "applicationContext-part2.xml"});
BeanFactory factory = (BeanFactory)context;

댓글 없음: