1:spring 配置文件中增加这句
    <task:annotation-driven/>  
2:确保扫描程序能够扫描后  下面第3步骤的java类
    <context:component-scan base-package="cms"/>  
3:AnnotationQuartz.java
Java代码

/**
     * User: liuwentao
     * Time: 13-10-22 下午3:36
     * 小说城网站欢迎访问: http://www.xiaoshuocity.com
     */  
    @Component  
    public class AnnotationQuartz {  
        @Scheduled(cron = "0 0/1 15,* * * ?")  
        //需要注意@Scheduled这个注解,它可配置多个属性:cron\fixedDelay\fixedRate  
        public void test() {  
            String dateStr = BaseDateUtil.getFormatString(new Date(), "yyyy-MM-dd HH:mm:ss");  
            System.out.println("小说城 www.xiaoshuocity.com 每分钟执行一次:" + dateStr);  
        }  
    }

4:spring 定时器 时间表达式解释
引用
"0 0 12 * * ?"
Fire at 12pm (noon) every day

"0 15 10 ? * *"
Fire at 10:15am every day

"0 15 10 * * ?"
Fire at 10:15am every day

"0 15 10 * * ? *"
Fire at 10:15am every day

"0 15 10 * * ? 2005"
Fire at 10:15am every day during the year 2005

"0 * 14 * * ?"
Fire every minute starting at 2pm and ending at 2:59pm, every day

"0 0/5 14 * * ?"
Fire every 5 minutes starting at 2pm and ending at 2:55pm, every day

"0 0/5 14,18 * * ?"
Fire every 5 minutes starting at 2pm and ending at 2:55pm, AND fire every 5 minutes starting at 6pm and ending at 6:55pm, every day

"0 0-5 14 * * ?"
Fire every minute starting at 2pm and ending at 2:05pm, every day

"0 10,44 14 ? 3 WED"
Fire at 2:10pm and at 2:44pm every Wednesday in the month of March.

"0 15 10 ? * MON-FRI"
Fire at 10:15am every Monday, Tuesday, Wednesday, Thursday and Friday

"0 15 10 15 * ?"
Fire at 10:15am on the 15th day of every month

"0 15 10 L * ?"
Fire at 10:15am on the last day of every month

"0 15 10 ? * 6L"
Fire at 10:15am on the last Friday of every month

"0 15 10 ? * 6L"
Fire at 10:15am on the last Friday of every month

"0 15 10 ? * 6L 2002-2005"
Fire at 10:15am on every last friday of every month during the years 2002, 2003, 2004 and 2005

"0 15 10 ? * 6#3"
Fire at 10:15am on the third Friday of every month

注解式开发spring定时器的更多相关文章

  1. Spring常用注解式开发

    1.组件注册@Configuration.@Bean给容器中注册组件. 注解,@Configuration告诉Spring这是一个配置类,相当于bean.xml配置文件. 注解,@Bean给Sprin ...

  2. Spring MVC (二)注解式开发使用详解

    MVC注解式开发即处理器基于注解的类开发, 对于每一个定义的处理器, 无需在xml中注册. 只需在代码中通过对类与方法的注解, 即可完成注册. 定义处理器 @Controller: 当前类为处理器 @ ...

  3. Spring MVC注解式开发

    MVC注解式开发即处理器基于注解的类开发, 对于每一个定义的处理器, 无需在xml中注册. 只需在代码中通过对类与方法的注解, 即可完成注册. 定义处理器 @Controller: 当前类为处理器 @ ...

  4. 总结切面编程AOP的注解式开发和XML式开发

    有段日子没有总结东西了,因为最近确实有点忙,一直在忙于hadoop集群的搭建,磕磕碰碰现在勉强算是能呼吸了,因为这都是在自己的PC上,资源确实有点紧张(搭建过程后期奉上),今天难得大家都有空(哈哈哈~ ...

  5. 3.2.3 SpringMVC注解式开发

    SpringMVC注解式开发 1. 搭建环境 (1) 后端控制器无需实现接口 , 添加相应注解 Controller类添加注解 @Controller //该注解表将当前类交给spring容器管理 @ ...

  6. SpringMVC笔记:annotation注解式开发

    一.配置式开发 在我们之前的学习中,springmvc使用配置式开发模式,需要在核心配置文件中springmvc.xml注册大量的bean来注入controller控制器,工作繁琐容易出错,下面我们学 ...

  7. shiro授权、注解式开发

    在ShiroUserMapper.xml中新增内容 <select id="getRolesByUserId" resultType="java.lang.Stri ...

  8. shiro授权+注解式开发

    shiro授权和注解式开发 1.shiro授权角色.权限 2.Shiro的注解式开发 ShiroUserMapper.xml <select id="getRolesByUserId& ...

  9. Shiro授权及注解式开发

    目的: shiro授权 shiro注解式开发 Shiro授权 首先设计shiro权限表: 从图中我们也清晰的看出五张表之间的关系 ShiroUserMapper Set<String> g ...

随机推荐

  1. 由于C++编译器的分析机制所导致的声明问题

    假设我们想声明一个STL的vector类型的变量,读入文件里的信息: std::ifstream in("data.txt"); std::vector<int> da ...

  2. SQL2008 清除日志

    USE [master] GO ALTER DATABASE BizTest SET RECOVERY SIMPLE WITH NO_WAIT GO ALTER DATABASE BizTest SE ...

  3. OS X升级El Capitan后,git difftool无法打开diffmerge的解决方法

    在git项目下执行git difftool,出现如下报错 /Library/Developer/CommandLineTools/usr/libexec/git-core/mergetools/dif ...

  4. 【逐步完善】MySql索引相关

    在表中对某个字段添加索引: alter table tablename add index (columnname);

  5. socket模块的getaddrinfo方法详解

    getaddrinfo方法用于通过url解析dns import sys,socket def dns_resolver(url): result = socket.getaddrinfo(url, ...

  6. jquery 农历日历 可自适应

    在网上找了许多大牛做的农历日历,但是不是不符合项目中的要求,就是本身就有问题有Bug ,把大牛门的做日历看了n遍 自己又改造了一遍得到了这个:随后日历又要做个自适应的长宽,又在js中改造代码..... ...

  7. OCP认证之Oracle的SQL语言基础(一)

    一.Oracle命令类别 数据操纵语言(DML):select;insert;delete;update;merge 数据定义语言(DDL):create;alter;drop;truncate 事物 ...

  8. vuex 笔记

    Vuex 笔记 一个简单的状态管理 单一数据源: const sourceOfTruth = {} const vmA = new Vue({ data: sourceOfTruth }) const ...

  9. shell 脚本,提取文件中的内容

    使用awk.cut.sed.if.while 等 awk.cut.sed还是很重要的 这是后来修改的,可以完成 #!/bin/bash #conver formatFILE=mobile_dpi.ru ...

  10. ubuntu下 too many file open 异常

    后台高并发或者多线程的情况下,无论是操作数据库还是操作文件,应用报出 too many file open 异常,其原因是受宿主系统文件数的限制.问题解决方式如下: 第一步:检查所在系统的文件数限制 ...