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. 别人整理的DP大全(转)

    动态规划 动态规划 容易: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ...

  2. Django进阶篇(二)

    中间件 解析 django 中的中间件(middleware),在django中,中间件其实就是一个类,在请求到来和结束后, django会根据自己的规则在合适的时机执行中间件中相应的方法. 在dja ...

  3. ESXi Install OpenWRT

    根据官方的提示,下载的img镜像需要转换为vmdk. 地址:http://wiki.openwrt.org/doc/howto/vmware 转换需要qemu-utils,网上的安装方法: #64位系 ...

  4. XE6 & IOS开发之开发者账号、苹果证书(1):关于开发者账号

    网上能找到的关于Delphi XE系列的移动开发的相关文章甚少,本文尽量以详细的图文内容.傻瓜式的表达来告诉你想要的答案. 原创作品,请尊重作者劳动成果,转载请注明出处!!! 关于苹果开发者账号, 注 ...

  5. JAVA编程规范(下)

    JAVA编程规范(下) 2016-03-27 6. 代码的格式化 6.1 对代码进行格式化时,要达到的目的 1.     通过代码分割成功能块和便于理解的代码段,使代码更容易阅读和理解: 2.     ...

  6. OS X 系统,修改hosts文件后不生效的问题

    系统版本 OS X El Capitan,10.11.2 问题描述 业务需要,配置“nexus”为某个ip,如下图更改了 /etc/hosts 文件. 结果在ping的时候,请求并未发到指定ip上. ...

  7. Samba 4 Domain Controller on Ubuntu 14.04 LTS

    1. Configure network with a static ip address $sudo nano /etc/network/interfaces auto eth0 iface eth ...

  8. 用iptables 实现本地端口转发

    设定本机2121端口转发到21端口 iptables -t nat -A PREROUTING -p tcp -i eth0 -d -j DNAT --to iptables -t nat -I PO ...

  9. 2016-09-19: linux后台运行

    linux后台运行命令两种方式: 1. command & : 后台运行,你关掉终端会停止运行   2. nohup command & : 后台运行,你关掉终端也会继续运行 简介 L ...

  10. MFC自绘控件不错的网站收集,不定时更新。

    找资料的时候,遇到好的网站收集起来,当时看看就忘记网址,下次再找又找不到,写下来才记得牢.欢迎大家留言,共同收集. 国外的: 1.codeproject https://www.codeproject ...