For completeness, code below shows the simplest possible way to configure scheduler with java config:
@Configuration
@EnableScheduling
public class SpringConfiguration {
@Bean(destroyMethod = "shutdown")
public Executor taskScheduler() {
return Executors.newScheduledThreadPool(5);
}
...
When more control is desired, a @Configuration
class may implement SchedulingConfigurer
.