BAEL-2490 Code samples (#6211)
* Added initial samples * Added initial samples * Awaitility updated
This commit is contained in:
committed by
KevinGilmore
parent
c60e6f1561
commit
312f633d15
@@ -0,0 +1,11 @@
|
||||
package com.baeldung.config;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
@ComponentScan("com.baeldung.scheduled")
|
||||
public class ScheduledConfig {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.baeldung.scheduled;
|
||||
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@Component
|
||||
public class Counter {
|
||||
private final AtomicInteger count = new AtomicInteger(0);
|
||||
|
||||
@Scheduled(fixedDelay = 5)
|
||||
public void scheduled() {
|
||||
this.count.incrementAndGet();
|
||||
}
|
||||
|
||||
public int getInvocationCount() {
|
||||
return this.count.get();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user