package gltronic.tronio;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

@SpringBootApplication
@EnableScheduling
@ComponentScan(basePackages = "gltronic.tronio")
@PropertySource("classpath:application.properties")
public class TronIoApplication {

	public static void main(String[] args) {
		SpringApplication.run(TronIoApplication.class, args);
	}

	@Bean
	public TaskScheduler taskScheduler() {
			ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();

			scheduler.setPoolSize(2);
			scheduler.setThreadNamePrefix("scheduled-task-");
			scheduler.setDaemon(true);

			return scheduler;
	}

}
