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();
    }
}
原文地址:https://www.cnblogs.com/xushirong/p/8471399.html