Results 1 to 3 of 3

Thread: @Scheduled(cron) does not support SpEL

Hybrid View

  1. #1
    Join Date
    May 2012
    Posts
    2

    Post @Scheduled(cron) does not support SpEL

    Hello,
    I've noticed that the @Scheduled annotation does not support SpEL ( I've noticed that the StringValueResolver interface is implemented by PlaceholderResolvingStringValueResolver etc, but not with any SpEL class ).
    Is there a way today to use SpEL in the @Scheduled annotation?
    If not - why? and will it be possible?

    Thanks,

    Noam

  2. #2
    Join Date
    Aug 2006
    Location
    Arequipa-Peru / South America
    Posts
    2,795

    Default

    Hello

    If you read the @Scheduled API it only work with cron.

    Seems you have must write statically your cron expression
    - Manuel Jordan

    Kill Your Pride, Share Your Knowledge With All
    The Fear Of The LORD Is The Beginning Of Knowledge, But Fools Despise Wisdom And Discipline. Proverbs 1:7

    Blog


    Technical Reviewer of Apress

    • Pro SpringSource dm Server
    • Spring Enterprise Recipes: A Problem-Solution Approach
    • Spring Recipes: A Problem-Solution Approach, 2nd Edition
    • Pro Spring Integration
    • Pro Spring Batch
    • Pro Spring 3
    • Pro Spring MVC: With Web Flow
    • Pro Spring Security

  3. #3
    Join Date
    May 2012
    Posts
    2

    Default

    Hi Dr.,

    Thanks for the reply - but I think my question was not clear.
    I used @Scheduled with cron expression by the following:
    When I used:
    1) Statically expression - It worked fine.
    2) Placeholder ( the expression was in scheduler.properties file and I've wrote @Scheduled(cron="${cron}") ) - It worked fine.
    3) SpEL ( I've used the same property file and wrote @Scheduled(cron="#{scheduler['cron']") ) - It didn't workd.
    So my question were:
    Did I do something wrong here?
    Does @Scheduled ( with cron ) support SpEL?
    If not - Is there intention of supporting SpEL in this situation?

    Thanks,

    Noam.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •