I have a code which runs at a regular interval. Below is code for that
@EnableScheduling
@Component
public class Cer {
@Autowired
private A a;
@Autowired
private CacheManager cacheManager;
@Scheduled(fixedDelayString = "${xvc}")
public void getData() {
getCat();
getB();
return;
}
}
I want to change@Scheduled(fixedDelayString = "${xvc}")
this based on a boolean say runOnce
if runOnce is true @scheduled should run once only say on code startup.
Any advice how to achieve this.
Thanks in advance.