Skip to content

@Scheduled annotation should support property placeholder values [SPR-6670] #11336

@spring-projects-issues

Description

@spring-projects-issues

Mark Fisher opened SPR-6670 and commented

This would promote externalization of the actual scheduling configuration.

Rather than:

@Scheduled(cron = "0 0 9-17 * * MON-FRI")
public void doSomething() {...}

The cron expression could be in a properties file, so the annotation no longer contains a hard-coded value:

@Scheduled("${schedules.businessHours}")
public void doSomething() {...}

This should also work with meta-annotations, e.g.:

@Scheduled(cron = "${schedules.businessHours}")
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)	
public @interface BusinessHours {}

...would apply to:

@BusinessHours
public void doSomething() {...}

Affects: 3.0 GA

Issue Links:

Referenced from: commits 410dd0a

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions