springMVC注解实现定时任务
来源:互联网 发布:台湾的网络直播平台17 编辑:程序博客网 时间:2024/06/07 10:18
这是springmvc配置文件中要配置的内容<!-- 开启注解定时任务的注解扫描 --> <task:annotation-driven/> <!-- 指定注解扫描的包 --> <context:annotation-config/> <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/> <context:component-scan base-package="com.jxust.svsh.task 执行代码的包,注意是包 不精确到类"/> <!--这是执行任务得类-->package com.jxust.svsh.task;import java.text.SimpleDateFormat;import org.springframework.scheduling.annotation.Scheduled;import org.springframework.stereotype.Component;import com.jxust.svsh.entity.wx_entity.WeixinContext;import com.jxust.svsh.wxutil.WxUtil;@Componentpublic class ScheduledTasks { private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); @Scheduled(initialDelay=1000,fixedRate = 3600000) //一两小时执行一次 public void updateAccessToken(){ WeixinContext.setAccess_token(WxUtil.ge_access_token().getAccess_token()); System.out.println("更新token"+WeixinContext.getAccess_token()); }}
0 0
- springMVC注解实现定时任务
- SpringMVC定时任务注解实现@Schedule
- springmvc注解式定时任务
- 注解定时任务实现
- SpringMvc实现定时任务
- SpringMVC框架使用注解执行定时任务
- springmvc基于注解的定时任务
- spring 注解实现 定时任务
- spring注解 实现定时任务
- springmvc+quartz,实现定时任务
- Spring定时任务——注解@Scheduled实现定时任务
- spring基于注解实现定时任务
- 基于spring注解实现定时任务
- 使用spring定时器注解实现定时任务
- Spring的@schedule注解实现定时任务
- spring注解scheduled实现定时任务
- 【JAVA】通过注解实现定时任务
- spring注解方式实现定时任务@Scheduled
- a*
- RSync实现文件备份同步
- Android之侧滑菜单DrawerLayout的使用
- 求割点模板——Network
- Java简单获取当前时间
- springMVC注解实现定时任务
- 工作常用软件
- 机器学习的经典教程
- MySQL主从复制原理及基本配置
- Struts2系列笔记(4)---Ation类访问servle
- jQuery选择器 过滤选择器(三.可见性过滤选择器)
- Android屏幕适配
- 从一台机器给另一台机器tomcat发请求,查看各个环节的耗时时间
- 简单实现C中sizeof函数是怎么实现的(面试的时候可能用到)