ssh2做的一个小网站中,想做个定时器,在web服务器启动后,在每天晚上12点时,执行一个Action中的一个方法,有什么简单的方式可以实现。
解决方案 »
- 读取xml报错:org.xml.sax.SAXParseException: 文件过早结束。
- Struts2 Action 中是否可以再起一个线程或者线程池? 请高手看看
- java发送邮件
- 求助关于junit测试类的问题
- Maven1的一个问题
- 我的处女作,花了一个月写的基于ssh和mysql的图书馆图书管理系统,功能都已实现。不知道水平如何,特拿出来请大侠指正批评
- 关于JSP嵌入播放器播放本地磁盘上的视频问题
- 请问哪有同时把struts+hibernate+spring三者结合的很简单的实例教程啊?(比如登录的小程序或有基本的
- 新手任何学习Java?
- BMP里的ejbLoad()方法出错
- httpinvoker 客户端调用错误
- JQuery+Ajax技术难题
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd"><bean id="AXXXXXXXX" class="你的action路径"/>
<!-- 定时任务 -->
<bean id="myJob"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<ref bean="AXXXXXXXX" />
</property>
<property name="targetMethod">
<value>要执行的方法名</value>
</property>
<property name="concurrent" value="false" />
</bean> <!-- -->
<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="myJob">
</property>
<property name="cronExpression">
<value>0 0 6 * * ?</value><!--设置定时时间-->
</property>
</bean> <!-- 启动调度 -->
<bean id="jobScheduler" autowire="no"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronTrigger" />
</list>
</property>
</bean>
</beans>