Scheduler not working when reading values from yaml file
application.yaml file content is
enode:
enable: Y
timer: 10 * * * * *
java file that reads above element from yaml file.
@Component
@ConfigurationProperties("enode")
public class EnodeConfigs {
private String enable;
private String timer;
controller code with scheduler
@Component
public class EnodeController {
@Autowired
private EnodeConfigs e;
@Bean
public String getTimer() {
return e.getTimer();
}
@Scheduled(cron = "#{@getTimer}")
public void delEnodeFiles() {
System.out.println("hello");
}
@Scheduled(cron = "10 * * * * *")
public void test() {
System.out.println("hii");
System.out.println(getTimer());
}
test method works as expected and it prints getTimer() value too. but delEnodeFiles() method not working. Quick help please. Thanks.