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>