Added event service

This commit is contained in:
Filip Izydorczyk 2020-12-21 17:12:10 +01:00
parent a294ecac37
commit 28c09bea6e
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,22 @@
package com.plannaplan.services;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@Service
public class EventService {
@Autowired
private EmailService emailService;
@Scheduled(cron = "0 2 17 * * *")
public void collectGroupLosses() {
System.out.println("Checking for groups");
}
@Scheduled(cron = "0 30 17 * * *")
public void testMail() {
this.emailService.sendMail("kaczor982@gmail.com", "Cześć. Jestem Tomek.");
}
}

View File

@ -16,9 +16,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.EnableScheduling;
import com.plannaplan.services.ConfiguratorService; import com.plannaplan.services.ConfiguratorService;
@SpringBootApplication @SpringBootApplication
@EnableScheduling
public class App { public class App {
public final static String API_VERSION = "v1"; public final static String API_VERSION = "v1";