How to pass the annotation attribute. I wanted to add my variable String(ans) in the Cron annotation but i am getting exception can you please suggest me how can i do it.
I wanted to get the corn pattern from the database and store it to the ans variable which is creating issue.
@Service
public class CronService {
@Autowired
UserDao userdao;
String ans="* * * * * *";
@Scheduled(cron="{ans}")
public void add() {
System.out.println("Hello");
}
}