KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying Spring 3's @Scheduled annotation . Here is my configuration (app.xml) : <?xml version="1.0" encoding="UTF-8"?> <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:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" 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.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd " > <context:component-scan base-package="destiny.web"/> <context:annotation-config/> // other beans <task:annotation-driven executor="myExecutor" scheduler="myScheduler"/> <task:executor id="myExecutor" pool-size="5"/> <task:scheduler id="myScheduler" pool-size="10"/> </beans> And this is my service class : @Service public class ServiceImpl implements Service , Serializable { //other injections @Override @Transactional public void timeConsumingJob() { try { Thread.sleep(10*1000); } catch (InterruptedException e) { e.printStackTrace(); } } @Override @Scheduled(cron="* * * * * ?") public void secondly() { System.err.println("secondly : it is " + new Date()); } } It works fine when testing in my eclispe + junit , when testing a time
Tags (comma-separated)
Save Edits
Cancel