import org.springframework.stereotype.Component;
/**
* 统计失败邮件定时重新发送
* 创建时间 2017年7月21日
*
*/
@Component("sendMail")
public class SendMail {
//@Scheduled(cron = "0/5 * * * * ?")
public void sendMail() {
System.out.println("统计失败邮件定时重新发送开始");
}
}
<!-- 配置任务线性池 --> <task:executor id="executor" pool-size="5" /> <task:scheduler id="scheduler" pool-size="5"/> <!-- 启用注解驱动的定时任务 --> <task:annotation-driven executor="executor" scheduler="scheduler" proxy-target-class="true"/> <task:scheduled-tasks scheduler="scheduler"> <!-- 统计失败邮件定时重新发送 --> <task:scheduled ref="sendMail" method="sendMail" cron="0/5 * * * * ?"/> </task:scheduled-tasks>
/**
* 启动类
* 创建时间 2017年7月19日
*
*/
@EnableAutoConfiguration
@ComponentScan(basePackages={"com.itstyle.main"})
@ImportResource({"classpath:spring-context-dubbo.xml","classpath:spring-context-task.xml"})
public class Application {
private static final Logger logger = Logger.getLogger(Application.class);
public static void main(String[] args) throws InterruptedException {
SpringApplication.run(Application.class, args);
logger.info("项目启动 ");
}
}
@Target({ java.lang.annotation.ElementType.METHOD,
java.lang.annotation.ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Repeatable(Schedules.class)
public @interface Scheduled {
public abstract String cron();
public abstract String zone();
public abstract long fixedDelay();
public abstract String fixedDelayString();
public abstract long fixedRate();
public abstract String fixedRateString();
public abstract long initialDelay();
public abstract String initialDelayString();
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有