Answer the question
In order to leave comments, you need to log in
How do I get the Spring scheduler up and running?
Hey guys. Tell me how to make the scheduler start and start working (Kotlin + Spring)?
@EnableScheduling
class ScheduledTasks {
private val dateFormat = SimpleDateFormat("HH:mm:ss")
@Scheduled(fixedRate = 5000)
fun reportCurrentTime() {
println("The time is now " + dateFormat.format(Date()))
}
}
@SpringBootApplication
@EnableWebFlux
class ServiceApplication
fun main(args: Array<String>) {
runApplication<ServiceApplication>(*args)
}
Answer the question
In order to leave comments, you need to log in
Your ScheduledTasks is not a bean, judging by what I see. It is necessary to make it such, either by hanging an annotation on it , or by declaring it
as elsewhere
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question