@Configuration
@EnableScheduling
public class ReminderConfiguration {
    @Autowired
    private Notifier notifier;

    @Bean
    @Primary
    public RemindingNotifier remindingNotifier() {
        RemindingNotifier remindingNotifier = new RemindingNotifier(notifier);
        remindingNotifier.setReminderPeriod(TimeUnit.MINUTES.toMillis(5)); 
        return remindingNotifier;
    }

    @Scheduled(fixedRate = 6000L) 
    public void remind() {
        remindingNotifier().sendReminders();
    }
}

results matching ""

    No results matching ""