spring定时器不起作用什么原因

J2EE 码拜 9年前 (2015-04-02) 1111次浏览 0个评论
 

web.xml 配置
context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
            classpath:/applicationContext-resources.xml
            classpath:/applicationContext-dao.xml
            classpath:/applicationContext-service.xml
            classpath*:/applicationContext.xml
            /WEB-INF/applicationContext*.xml
                  </param-value>
</context-param>
applicationContext.xml  配置

<bean id=”testtask” class=”cn.com.base.webapp.Test”></bean>
    <bean id=”dayClock” class=”org.springframework.scheduling.timer.ScheduledTimerTask”>
        <property name=”timerTask”><ref bean=”testtask”></ref></property>
        <property name=”period”><value>10</value></property>
        <property name=”delay”><value>10</value></property>
    </bean>
    
    <bean class=”org.springframework.scheduling.timer.TimerFactoryBean”>
        <property name=”scheduledTimerTasks”>
            <list>
                <ref bean=”dayClock”></ref>
            </list>
        </property>
    </bean>
java 类
public class Test extends TimerTask {
    
    
    public void run() {
        System.out.println(“定时任务 : ” + new Date());
       
    }
}
没有起到效果,是什么原因啊

spring定时器不起作用什么原因
20分
http://www.blogjava.net/Steven-bot/articles/363924.html
spring定时器不起作用什么原因
10分
spring定时任务的几种实现http://gong1208.iteye.com/blog/1773177
spring定时器不起作用什么原因
10分
你搜索下,最好用注解的方式, xml 定义的我感觉没有注解的方便。

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明spring定时器不起作用什么原因
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!