@Lazy
@Component
public class ScheduleTest {
@Scheduled(fixedRate = 1000)
public void doSomething(){
System.out.println("do something"+ new Date());
}
}
when i set the lazy(value=false),it works.
@Lazy
@Component
public class ScheduleTest {
@Scheduled(fixedRate = 1000)
public void doSomething(){
System.out.println("do something"+ new Date());
}
}
when i set the lazy(value=false),it works.
Based on the following Jira ticket, it works from Spring 4.3 RC2
version.
Logically it didn't work, because @Lazy
means that don't instantiate this bean, unless it is injected somewhere, but @Scheduled
proxy was created when the bean was instantiated.