没什么可说的, 今天把以前配置的一个job重新整理了下,用maven管理了。
应该说用Maven的特性更多一些:打成的jar是可运行的, 打成的jar包里包括了运行所依赖的jar。
执行“mvn package”后, 再运行“java -jar .\target\rmn190Proj-jar-with-dependencies.jar”命令。
如下输出:
main started. and current second is: 1
job executed.current second is: 30
job executed.current second is: 35
job executed.current second is: 40
job executed.current second is: 45
job executed.current second is: 50
job executed.current second is: 55
============
关于job运行时间点,applicationContext.xml文件中有如下说明
<!--
1 Seconds (0–59)
2 Minutes (0–59)
3 Hours (0–23)
4 Day of month (1–31)
5 Month (1–12 or JAN–DEC)
6 Day of week (1–7 or SUN–SAT)
7 Year (1970–2099)
-->
<!-- 每隔5秒跑一次,30表示首次执行时等30秒,
实验所得数据如下:
main started. and current second is: 1
job executed.current second is: 30
job executed.current second is: 35
job executed.current second is: 40
job executed.current second is: 45
job executed.current second is: 50
job executed.current second is: 55
job executed.current second is: 30
job executed.current second is: 35
job executed.current second is: 40
-->
<property name="cronExpression" value="30/5 * * * * ?" />