0

i have a configuration class FTPSchedullingConfiguration which is initialise at app instantiation and get data from table for Starting a scheduler on given Scheduling Expression.

And also my question are not Duplicate as Reloading/Refreshing Spring configuration file without restarting the servlet container like this because i have no any XML File, my application is based on annotation and here Every classes are compiled in .class formate so we can`t change any code at runtime.

@Configuration
@EnableScheduling
public class FTPSchedullingConfiguration {

@Autowired
private FTPTransferServiceInterface ftpTransferServiceInterface;

@Bean
public String getCronFTPTransferValue()
{
    return ftpTransferServiceInterface.getFTPTransferById((long) 1).getTransferCroneTime();
}

 @Scheduled(cron="#{@getCronFTPTransferValue}")
 public void ftpTransfer() {
    ftpTransferServiceInterface.transferFTPRecording();
 }
}

But when i change the Schedule Expression of table then no changing on scheduled time. if i restart server then changed Expression load.

by using updateFTP(),

@RequestMapping(value= {"/updateFTPTransfer"})
private String updateFTP(...){
  ftpTransferServiceInterface.updateFTP(ftpDomain);
    //here i want to change the value of @Scheduled 
}

my actual need like when i changed Expression value in table by updateFTP(...){...} at that time also my schedulling value changed (OR) Refreshed FTPSchedullingConfiguration class.

Thanks in Advance.

programmer420
  • 47
  • 1
  • 11
  • Possible duplicate of [Reloading/Refreshing Spring configuration file without restarting the servlet container](https://stackoverflow.com/questions/534030/reloading-refreshing-spring-configuration-file-without-restarting-the-servlet-co) – rchakraborty Jun 06 '19 at 13:43
  • Hello @rchakraborty my question are not Duplicate as [https://stackoverflow.com/questions/534030/reloading-refreshing-spring-configuration-file-without-restarting-the-servlet-co][1] like this because i have no any XML File my application is based on annotation and here Every classes are compiled in .class formate so we can`t change any code at runtime. we only change the value of object, and here thats my need please read my Question clearly. Thanks. – programmer420 Jun 07 '19 at 06:17

0 Answers0