Spring @Scheduled cron details from property file - Exception

前端 未结 2 1302
醉梦人生
醉梦人生 2020-12-20 02:27

I was trying to define the cron details in my spring @Scheduled method

@Service
@PropertySource(\"classpath:application.properties\")
public class CacheRefre         


        
相关标签:
2条回答
  • 2020-12-20 02:47

    Adding the below to my ApplicationContext resolved the issue..

    @Bean
    public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
           return new PropertySourcesPlaceholderConfigurer();
        }
    
    0 讨论(0)
  • 2020-12-20 02:59
    factoryBean.setCronExpression("0 0/1 * 1/1 * ? *"); 
    

    you have to set Cron Expresssion bcz in BeanFactory Class the setCronExpression is mandatory

    0 讨论(0)
提交回复
热议问题