I build simply web application with Spring Boot but I need to create Sheduled task in Application that I create Cron job but dont working. That is my code for task:
@Component
public class CronService {
@Autowired
private XmlDeserializer xmlDeserializer;
@Autowired
private CurrencyRepository currencyRepository;
@Scheduled(cron = "0 12 0 * * *", zone = "Europe/Sofia")
public void saveData() throws IOException, SAXException, ParserConfigurationException {
...
}
And this is my Аpplication.java code for Spring boot:
@SpringBootApplication
@EnableScheduling
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}