String[] config = new String[] { "applicationContext.xml" };

config 에 applicationContext.xml을 넣고

ApplicationContext context = new ClassPathXmlApplicationContext(config);

ApplicationContext를 context 레퍼변수로 설정하여 config를 불러와서 config 안에 있는 모든 class객체를 생성 시킨다.

MemberService p = (MemberServiceImpl) context.getBean("service");

context에서 getBean으로 bean 중 id가 service인 beand을 불러와서

MeberService 에 저장 시킨다.

블로그 이미지

김진리

,