Spring中定时任务的实现

package com.yt.project.stockpledge.schedule;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.yt.project.stockpledge.service.SpProjectServies;
//将该类交给spring管理
@Component
public class TimeOutStatus {
    @Autowired
    private SpProjectServies service;
    //spring定时任务详解(@Scheduled注解)
    @Scheduled(cron = "0 0 23 ? * *")
    public void timeOutStatus() {
        //实现的业务
        service.updateStatus();
    }
}

 

posted @ 2018-02-26 08:39  lszan  阅读(205)  评论(0编辑  收藏  举报