功能描述:剛開始接觸Quartz
核心jar:
郵件發送
quartz
spring
只貼出核心代碼:
Email發送
package monsemail;
import java
import java
import java
import javax
import mons
/** *//**
* 功能描述:此代碼主要實現郵件發送功能
* @author coder
*
*/
public class SendSimplEmail {
public static void sendMail()throws Exception{
List<InternetAddress> list=new ArrayList<InternetAddress>();
list
list
SimpleEmail email=new SimpleEmail();
email
email
email
email
email
email
email
email
email
}
}
定義調度工作任務
package com
import org
import org
import org
import monsemail
/** *//**
* 發送email任務
* @author coder
*
*/
public class SendEmailJob extends QuartzJobBean{
@Override
protected void executeInternal(JobExecutionContext context)
throws JobExecutionException {
try {
//調用郵件發送代碼
SendSimplEmail
} catch (Exception e) {
e
}
}
}
spring核心配置文件
<!
<bean id=
<property name=
<!
<value>com
</property>
<!
<!
<property name=
<map>
<entry key=
<ref bean=
</entry>
</map>
</property>
</bean>
<!
<bean id=
<property name=
<!
<property name=
<value>
</property>
<!
<property name=
<value>
</property>
<!
<property name=
<value>
</property>
</bean>
<!
<bean id=
<property name=
<list>
<ref bean=
</list>
</property>
</bean>
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28292.html