Timing layer task controller

 

@RestController 
@RequestMapping ( "/ expenseList") 
@ SLF4J 
@Component 
@Configuration //. 1. The main configuration classes for marking, the effect of both the Component. 
@EnableScheduling // 2. opening timing task 
public class ExpenseListController { 

    // generate fee schedule 
    // 1. Timing generating 
    @Scheduled (the cron = "0 0 0 * / 1 *?") 
    // 2. Directly specified time interval, e.g. : 5 seconds 
    // @ the Scheduled (fixedRate = 60 * 1000 *) 
    public ResultModel productExpenseTable () { 
        . // get the current date. 1 
        log.info ( "===== performed automatically generating cost table ======= {} = ", LocalDateTime.now ()); 
        the LocalDate LocalDate.now = now (); 
        writeExpenseList (now); 
        return new new ResultModel (ResultModel.SUCCESS, LocalDateTime.now () +" charges generated automatically successful !! ");

}

  

Guess you like

Origin www.cnblogs.com/ynhk/p/11525412.html