Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am current developing an application based on Spring-Boot.

I know that annotation like @Scheduled can schedule tasks. Since users in my application wanna send mails at different time and send only once.

I have already read the post Spring scheduling task - run only once, but it is weird always "new" an localExecutor in a Spring based application.

In that way , once a user schedule sending an email, I have to "new" an localExecutor for his task.

So , are there any better ways?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
459 views
Welcome To Ask or Share your Answers For Others

1 Answer

The simplest way to schedule tasks in Spring is to create method annotated by @Scheduled in spring managed bean. It also required @EnableScheduling in any @Configuration classes.

Spring tutorial


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...