Parameterizing Spring @Scheduled with default value
<p>I need to parameterize a <code>@Scheduled</code> method with value from my properties file if present, or default value if not.</p>

<p>We can parameterize from configuration file property in the following way:</p>

<pre><code>@Scheduled(cron = "${my.task.cron-exec-expr}")
public void scheduledTask() {
    // do something
}
</code></pre>

<p>but if the property does not exist we'll have a runtime exception. </p>

<p>I've tried using a <code>@ConfigurationProperties</code> bean with default value, with no success:</p>

<pre><code>@Component
@ConfigurationProperties(prefix = "my.task")
public class MyTaskProperties {

    private String cronExecExpr = "*/5 * * * * *";

    // getter and setter
}
</code></pre>

<p>How to avoid that and pass a default value?</p>