I'm reading a code and it's using Spring Scheduled
@Component
public class TaskWebSocketClient {
@Scheduled(fixedDelay = 20000, initialDelay = 10000)
void start() {
try {
WebSocketPush.start();
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
}
I'm using the searching of Visual Studio code and the word "TaskWebSocketCliente" never been used again. So the class "TaskWebSocketClient" never was been instantiated, but debugging I resolve that the @Scheduled is working. So how a code can run a Scheduled on a class which the class never was instantiated?