quartz配置定时任务启动

1.配置文件设置如下:




    
    
        
            
                
            
        
    

    
    
        
            
        
        
            0/59 * * * * ? 
        
    

    
    
        
            
        
        
            doWork
        
    

    
    

2.任务类如下:

package com.base;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

@Component
@Transactional
public class PerformanceJob {
    Logger log = LoggerFactory.getLogger(PerformanceJob.class);

    public void doWork() throws Exception {
        log.info("定时任务开始执行.........." + new Date());
    }

}

3.cron表达式在线学(生)习(成),超级好用的呢 (*^▽^*):

http://cron.qqe2.com/

http://qqe2.com/cron

你可能感兴趣的:(Java,定时任务)