`
xielioo
  • 浏览: 7911 次
  • 性别: Icon_minigender_1
  • 来自: 上海
最近访客 更多访客>>
社区版块
存档分类
最新评论

Spring 3.0 后台任务

    博客分类:
  • JAVA
 
阅读更多
配制文件:
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:task="http://www.springframework.org/schema/task"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
						http://www.springframework.org/schema/beans/spring-beans-3.1.xsd   
						http://www.springframework.org/schema/context   
						http://www.springframework.org/schema/context/spring-context-3.1.xsd   
						http://www.springframework.org/schema/task 
						http://www.springframework.org/schema/task/spring-task-3.0.xsd">

<task:executor id="executor" pool-size="5" />  
<task:scheduler id="scheduler" pool-size="10" />  
<task:annotation-driven executor="executor" scheduler="scheduler" />


@Service
public class SmsRecvTask {
	
	@Scheduled(fixedDelay=5000)  
    public void doSimpleThing(){  
        System.out.println(System.currentTimeMillis());  
    }  
      
    public void doSimpleThing2(){  
        System.out.println("simpleThing2");  
    }  
      
    public void doSimpleThing3(){  
        System.out.println("simpleThing3");  
    }  
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics