1 添加
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
@Bean
public static PropertySourcesPlaceholderConfigurer propertyConfigInDev() {
return new PropertySourcesPlaceholderConfigurer();// //使spring能夠識別 ${cron}
}
@Scheduled(cron = "${cron}")//每隔5分鍾執行一次
這樣就可以了