2
    @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.

islandev
  • 33
  • 5

1 Answers1

2

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.

helospark
  • 1,420
  • 9
  • 12