Files
spring-boot-rest/jee-7/src/main/java/com/baeldung/timer/AutomaticTimerBean.java
Doha2012 2e5531edd0 group and cleanup (#3027)
* move security content from spring-security-rest-full

* swagger update

* move query language to new module

* rename spring-security-rest-full to spring-rest-full

* group persistence modules

* group testing modules

* try fix conflict

* cleanup

* group and cleanup
2017-11-13 16:45:26 +01:00

28 lines
594 B
Java

package com.baeldung.timer;
import javax.ejb.Schedule;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.enterprise.event.Event;
import javax.inject.Inject;
import java.util.Date;
@Startup
@Singleton
public class AutomaticTimerBean {
@Inject
Event<TimerEvent> event;
/**
* This method will be called every 10 second and will fire an @TimerEvent
*/
@Schedule(hour = "*", minute = "*", second = "*/10", info = "Every 10 second timer")
public void printDate() {
event.fire(new TimerEvent("TimerEvent sent at :" + new Date()));
}
}