Junit Spring ApplicationContext (Applacation Bean Test, Spring Bean Call)
2.FileSystemXmlApplicationContext : 파일시스템에 있는 XML 빈 설정을 이용할때 사용한다.
* sampel
* $Id: mailSender.java ,v 1.1 2010. 9. 8. 오후 3:33:43 smrscvs1 Exp $
* created by : ahn
* creation-date : 2010. 9. 8.
* =========================================================
* Copyright (c) 2010 ManInSoft, Inc. All rights reserved.
*/
package test.mailSender;
import javax.mail.MessagingException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import com.dongbu.farm.common.mail.MimeMailSender;
/**
* ClassPathXmlApplicationContext : classPath 에 있는 XML 빈 설정 파일을 이용할때 사용.
* FileSystemXmlApplicationContext : 파일시스템에 있는 XML 빈 설정을 이용할때 사용한다.
*
* SendMail Test Class
* @author ahn
*
*/
public class mailSender {
public static void main(String[] args) {
new String[] { "/WebContent/WEB-INF/applicationContext/applicationContext-mail.xml" });
MimeMailSender sender = (MimeMailSender) ctx.getBean("mimeMailSender");
try {
sender.sendMail("mycup@nate.com", "an.sangkil@gmail.com",
"Mail Send Test", "Hello Mail Send Test, That's OK?");
} catch (MessagingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
BOX 공간에 보면 Bean을 호출한다. 호출하고자 하는 Bean 사용,