0
xml 파일에서만 예상대로 작동하는 하나의 스케줄러를 작성했습니다. 하지만 Javaconfig 클래스로 실행할 수 없습니다. 다음은 코드입니다.@Scheduled가 Javaconfig와 작동하지 않습니다.
스케줄러 :
public class DemoServiceBasicUsageCron {
@Scheduled(cron="*/5 * * * * ?")
public void demoServiceMethod()
{
System.out.println("Method executed at every 5 seconds. Current time is :: "+ new Date());
}}
자바 설정 :
@Configuration
public class TestCron {
@Bean
public DemoServiceBasicUsageCron demoCron() {
System.out.println(" bean created ");
return new DemoServiceBasicUsageCron();
}}
나는 그것이 작동 할 수
public static void main(String[] args) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(TestCron.class);
}
필요한 제안으로 구성 파일을 읽고 있습니다. TestCron 클래스의
감사 사이
감사합니다. @abaghel. 괜찮 았어. – abc