Jeesite cron定时

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_44369725/article/details/85625848

Jeesite cron定时

spring-context.xml配置

<!-- 计划任务配置,用 @Service @Lazy(false)标注类,用@Scheduled(cron = "0 0 2 * * ?")标注方法 -->
<task:executor id="executor" pool-size="10" />
<task:scheduler id="scheduler" pool-size="10" />
<task:annotation-driven scheduler="scheduler"
	executor="executor" proxy-target-class="true" />
<!--  
<context:component-scan base-package="com.qa.modules.test.cron"/>-->

@Component
@EnableScheduling
@Lazy(false)
public class test{

	/*quartz支持年份,而Spring Task不支持,所以cron只支持6位
	定时任务方法不能带参数,不能有返回值*/
	@scheduled(cron="0 0 2 * * ?")
	public void scyn(){}

}

猜你喜欢

转载自blog.csdn.net/weixin_44369725/article/details/85625848