使用@Scheduled注解编写spring定时任务
2024-09-29 21:30:16
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; /**
* Created by chenguangjin on 2018/3/9.
*/
@Service
public class ScheduledTest { @Scheduled(cron = "0 0/1 * * * ?")
public void scheduledMethod(){
System.out.println("scheduled method start!");
} }
依赖:
<properties>
<spring.version>4.3.6.RELEASE</spring.version>
</properties> <dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
最新文章
- Github fork同步
- 使用UIKit制作卡牌游戏(三)ios游戏篇
- iOS开发工具——网络封包分析工具Charles
- Android 学习笔记之AndBase框架学习(三) 使用封装好的函数完成Http请求..
- 【剑指offer】判断二叉树是否为平衡二叉树
- 1003: A Bug
- Delphi 6 Web Services初步评估
- Windows 下如何安装配置Snort视频教程
- UVA 12232 - Exclusive-OR(带权并查集)
- 根据用户的ID查用户的名字
- 移动web开发经验总结(1) (转)
- python基本使用事项
- C# 解决“请求被中止: 未能创建 SSL/TLS 安全通道”的问题
- 第九篇——Struts2的拦截器
- 使用Intellij中的Spring Initializr来快速构建Spring Boot/Cloud工程(十五)
- [UWP开发] 在低版本中使用亚克力刷以及部分高版本控件
- 针对Properties中实时性要求不高的配置参数,用Java缓存起来
- C# List的深复制
- iframe加载方案及性能
- [BZOJ4320][ShangHai2006]Homework(根号分治+并查集)
热门文章
- Algorithm | Random
- POJ 1704 Georgia and Bob [博弈]
- java.lang.NoSuchMethodError: main Exception in thread ";main"; ===Exception
- readis 内部数据结构
- ios内存管理笔记(二)
- OpenCV3.1使用SIFT
- .NET创建宿主设计器--DesignHost、DesignSurface.
- DesignSurface简介
- C 作用域规则
- 【SharePoint】SharePoint2013中使用客户端对象模型给用户控件赋初值