正确写法: @Scheduled(cron = "\${foo.bar:-}" fun fooBar() { } 必须在注解中给出默认值,bean对象中设置的默认值,任务初始化时取不到,所以会报错,建议将所有任务的cron默认值设置为'-'