zoukankan      html  css  js  c++  java
  • Spring talk简单配置

    XMl文件

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:task="http://www.springframework.org/schema/task"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/task
    http://www.springframework.org/schema/task/spring-task-3.0.xsd">

    <task:annotation-driven /> <!-- 定时器开关-->
    <bean id="TalkController" class="cn.springmvc.talk.TalkController"></bean>
    <task:scheduled-tasks>
    <!--
    这里表示的是每隔五秒执行一次
    -->
    <task:scheduled ref="TalkController" method="talkTest" cron="*/5 * * * * ?" />
    </task:scheduled-tasks>

    <!-- 自动扫描的包名 -->
    <context:component-scan base-package="cn.springmvc.talk" />
    </beans>

    java文件

    package cn.springmvc.talk;

    public class TalkController {
    public void talkTest(){
    System.out.println("任务开始");
    }

    }

  • 相关阅读:
    反射
    left join 多个表关联时,将表值置换
    distinct 与 group by 去重
    常见错误
    字符串的处理
    排版样式
    VS低版本打开高版本解决方案(如08打开10、12、13版本vs编译的项目)
    Dw CS 破解
    VS2013如何避开安装时IE10的限制
    UVa540 Team Queue
  • 原文地址:https://www.cnblogs.com/Seeasunnyday/p/5483071.html
Copyright © 2011-2022 走看看