1.xml配置方式
web.xml
spring配置檔案
這裡定時每分鐘的的零秒開始執行
java類,方法無傳回值
2.注解方式
<context:annotation-config/>
作用是顯式地向 spring 容器注冊
autowiredannotationbeanpostprocessor、commonannotationbeanpostprocessor、
persistenceannotationbeanpostprocessor 以及 requiredannotationbeanpostprocessor 這 4 個beanpostprocessor。注冊這4個 beanpostprocessor的作用,就是為了你的系統能夠識别相應的注解。
是以當使用 <context:component-scan/> 後,就可以将 <context:annotation-config/> 移除了。
java類
預設是單線程的
參考文章:
<a href="http://my.oschina.net/u/559635/blog/389558" target="_blank">http://my.oschina.net/u/559635/blog/389558</a>
<a href="http://blog.sina.com.cn/s/blog_872758480100wtfh.html" target="_blank">http://blog.sina.com.cn/s/blog_872758480100wtfh.html</a>