diff --git a/buisnesslogic/src/main/java/com/plannaplan/services/EventService.java b/buisnesslogic/src/main/java/com/plannaplan/services/EventService.java new file mode 100755 index 0000000..629265f --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/services/EventService.java @@ -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."); + } +} diff --git a/restservice/src/main/java/com/plannaplan/App.java b/restservice/src/main/java/com/plannaplan/App.java index 438335e..d77366b 100755 --- a/restservice/src/main/java/com/plannaplan/App.java +++ b/restservice/src/main/java/com/plannaplan/App.java @@ -16,9 +16,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.event.EventListener; +import org.springframework.scheduling.annotation.EnableScheduling; + import com.plannaplan.services.ConfiguratorService; @SpringBootApplication +@EnableScheduling public class App { public final static String API_VERSION = "v1";