Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package ru.elcor.mis.scheduler.config; import java.lang.annotation.Annotation; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.io.ClassPathResource; import org.springframework.scheduling.annotation.EnableScheduling; import ru.elcor.mis.scheduler.core.Job; /** * * @author Abramov A.O */ @Configuration @EnableScheduling @PropertySource("classpath:scheduler.properties") public class AppConfig { @Bean public Job Job() { return new Job(); } @Bean public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { PropertySourcesPlaceholderConfigurer properties = new PropertySourcesPlaceholderConfigurer(); Properties Props = new Properties(); Props.setProperty("cron", "0-59/2 * * * * *"); properties.setProperties(Props); properties.setLocation(new ClassPathResource("scheduler.properties")); properties.setIgnoreResourceNotFound(false); return properties; } }