How could I enabled scheduled jobs only in specific profiles?
pseudocode:
@Scheduled(cron = "${job.cron}")
@Profile("prod")
public void runJob() {
}
Is that possible?
You should have one bean per profile:
@Component
@Profile("prod")
public class ProdJob {
@Scheduled(cron = "${job.cron}")
public void runJob() {
}
}
@Component
@Profile("beta")
public class BetaJob {
@Scheduled(cron = "${job.cron}")
public void runJob() {
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With