0

We have spring boot app, which contains the one method annotated with @Scheduled, in a class. I created jar file from this spring boot app and added this as dependency in another spring boot application, when I started this second main spring boot application, I expected the method annotated with @Scheduled, to execute every minute (I configured like in that application.yml of the first spring boot app). But this not running like this. When I tested the first spring boot app along as app, it is working method is invoked every 1 minute, can any one help why the same method not working when I added as jar to another spring boot app.

Note : the second main spring boot app, does not contain any more classed expect one class annotated with

@SpringBootApplication
@EnableScheduling

can anyone please suggest why this is not working ?

M. Deinum
  • 115,695
  • 22
  • 220
  • 224
Bravo
  • 8,589
  • 14
  • 48
  • 85

1 Answers1

-1

The bean/component that includes the @Scheduled doesn't get created. You either create the bean yourself or tell Spring where to look. E.g. by using @ComponentScan.

msp
  • 3,272
  • 7
  • 37
  • 49
  • @msparser , i already added @ComponentScan(basePackages = {"", ""}) , even then also method is not triggered – Bravo Jan 23 '18 at 13:32