Backend/๐ŸŒฑ Spring

[์Šค์ผ€์ค„๋ง]Spring Scheduler๋กœ ์ž„์‹œ ์ฒจ๋ถ€ํŒŒ์ผ ์ •๋ฆฌํ•˜๊ธฐ

HS0601 2026. 4. 25. 12:04

 

Spring ์Šค์ผ€์ค„๋ง

 

https://docs.spring.io/spring-framework/reference/integration/scheduling.html

 

Task Execution and Scheduling :: Spring Framework

All Spring cron expressions have to conform to the same format, whether you are using them in @Scheduled annotations, task:scheduled-tasks elements, or someplace else. A well-formed cron expression, such as * * * * * *, consists of six space-separated time

docs.spring.io

 

 

 

Spring ์Šค์ผ€์ค„๋ง์€ ์‰ฝ๊ฒŒ ๋งํ•ด ์„œ๋ฒ„๊ฐ€ ์ผœ์ ธ์žˆ๋Š” ๋™์•ˆ, ๋‚ด๊ฐ€ ์ •ํ•œ ์‹œ๊ฐ„๋งˆ๋‹ค ํŠน์ • ๋ฉ”์„œ๋“œ๋ฅผ ์ž๋™ ์‹คํ–‰ํ•˜๊ฒŒ ๋งŒ๋“œ๋Š” ๊ธฐ๋Šฅ์ด๋‹ค

Spring์•„, ์ด ํ”„๋กœ์ ํŠธ์—์„œ @Scheduled๋ถ™์€ ๋ฉ”์„œ๋“œ๋ฅผ ์ฐพ์•„์„œ ์ž๋™ ์‹คํ–‰ํ•ด์ค˜ -> @EnableScheduling
@Configuration
@EnableScheduling
public class SchedulingConfig {
}

๊ณต์‹๋ฌธ์„œ์—์„œ๋Š” "To enable support for @Scheduled … add @EnableScheduling to one of your @Configuration classes."๋ผ๊ณ  ๋‚˜์™€์žˆ๋‹ค ์ฆ‰ @Scheduled ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ์„ค์ • ํฌ๋ž ์Šค ์ค‘ ํ•˜๋‚˜์— @EnableScheduling์„ ์ถ”๊ฐ€ํ•˜๋ผ๋Š” ๋ง์ด๋‹ค

๋”๋ณด๊ธฐ

@Configuration : Spring ์„ค์ • ํŒŒ์ผ ์—ญํ• ์„ ํ•˜๋Š” ํด๋ž˜์Šค๋ผ๋Š” ํ‘œ์‹œ

@EnableScheduling : Spring์—๊ฒŒ ์Šค์ผ€์ค„๋ง ๊ธฐ๋Šฅ ์ผœ๋ผ๋ผ๊ณ  ์•Œ๋ ค์ฃผ๋Š” ์–ด๋…ธํ…Œ์ด์…˜ - ์Šค์œ„์น˜

์ด ๋ฉ”์„œ๋“œ๋ฅผ ๋งค์ผ ์ƒˆ๋ฒฝ 3์‹œ์— ์ž๋™ ์‹คํ–‰ํ•ด์ค˜ -> @Scheduled
@Component
public class AttachmentCleanupScheduler {

    @Scheduled(cron = "0 0 3 * * *")
    public void deleteOldTempAttachments() {
        // ์˜ค๋ž˜๋œ ์ž„์‹œ ์ฒจ๋ถ€ํŒŒ์ผ ์‚ญ์ œ
    }
}

๊ณต์‹๋ฌธ์„œ์—์„œ๋Š” "You can add the @Scheduled annotation to a method, along with trigger metadata."๋ผ๊ณ  ๋‚˜์™€์žˆ๋‹ค

์ฆ‰, ๋ฉ”์„œ๋“œ์— @Scheduled๋ฅผ ๋ถ™์ด๊ณ  ์–ธ์ œ ์‹คํ–‰ํ• ์ง€์— ๋Œ€ํ•œ ์‹คํ–‰ ์กฐ๊ฑด๋„ ๊ฐ™์ด ์ ์„ ์ˆ˜ ์žˆ๋‹ค๋Š” ๋ง์ด๋‹ค ์—ฌ๊ธฐ์„œ ์ค‘์š”ํ•œ ๊ฑด ์ปจํŠธ๋กค๋Ÿฌ์ฒ˜๋Ÿผ ์‚ฌ์šฉ์ž์˜ ์š”์ฒญ์ด ๋“ค์–ด์™€์•ผ ์‹คํ–‰๋˜๋Š” ๊ฒŒ ์•„๋‹ˆ๋ผ๋Š” ๊ฒƒ.

์„œ๋ฒ„ ์ผœ์ง
→ ์ •ํ•ด์ง„ ์‹œ๊ฐ„์ด ๋จ
→ Spring์ด ์•Œ์•„์„œ ๋ฉ”์„œ๋“œ ์‹คํ–‰
๋”๋ณด๊ธฐ

trigger metadata : ์–ธ์ œ ์‹คํ–‰ํ• ์ง€ ์•Œ๋ ค์ฃผ๋Š” ์ดˆ๊ธฐ๊ฐ’ (cron, fixedDelay, fixedRate)

์•„๋ž˜ ๋ฉ”์„œ๋“œ๋Š” 5์ดˆ๋งˆ๋‹ค ์‹คํ–‰ํ•ด์ค˜ -> fixedDelay
@Scheduled(fixedDelay = 5000)
public void doSomething() {
    // something that should run periodically
}

๊ณต์‹๋ฌธ์„œ์—์„œ๋Š” ์ด ๋ฉ”์„œ๋“œ๊ฐ€ ์ด๋ ‡๊ฒŒ ๋™์ž‘ํ•œ๋‹ค๊ณ  ์„ค๋ช…ํ•˜๊ณ  ์žˆ๋‹ค "the period is measured from the completion time of each preceding invocation." ๋‹ค์Œ ์‹คํ–‰๊นŒ์ง€์˜ ์‹œ๊ฐ„์€ ์ด์ „ ์‹คํ–‰์ด ๋๋‚œ ์‹œ์ ๋ถ€ํ„ฐ ๊ณ„์‚ฐ๋œ๋‹ค๋Š” ๋ง์ด๋‹ค

์˜ˆ๋ฅผ๋“ค๋ฉด

12:00:00 ์ž‘์—… ์‹œ์ž‘
12:00:03 ์ž‘์—… ๋๋‚จ
fixedDelay = 5์ดˆ
12:00:08 ๋‹ค์Œ ์ž‘์—… ์‹œ์ž‘

 Spring ์Šค์ผ€์ค„๋ง์˜ ๊ธฐ๋ณธ ์„ ํƒ์ง€

1. fixedDelay
2. fixedRate
3. cron
+ initialDelay

1. fixedDelay

https://docs.spring.io/spring-framework/docs/4.2.7.RELEASE/spring-framework-reference/html/scheduling.html

 

33. Task Execution and Scheduling

In addition to the TaskExecutor abstraction, Spring 3.0 introduces a TaskScheduler with a variety of methods for scheduling tasks to run at some point in the future. The simplest method is the one named 'schedule' that takes a Runnable and Date only. That

docs.spring.io

 

 

 

fixedDelay๋Š” ์ด์ „ ์ž‘์—…์ด ๋๋‚œ ๋’ค ์ •ํ•ด์ง„ ์‹œ๊ฐ„๋งŒํผ ๊ธฐ๋‹ค๋ ธ๋‹ค๊ฐ€ ๋‹ค์Œ ์ž‘์—…์„ ์‹คํ–‰ํ•˜๋Š” ๋ฐฉ์‹์ด๋‹ค ์œ„์—์„œ ๋‹ค๋ฃฌ ๊ฒƒ์ฒ˜๋Ÿผ, ๊ณต์‹๋ฌธ์„œ์—์„œ๋Š” " The fixedDelay attribute … makes sure that there is a delay of five seconds between the finish time of an execution and the start time of the next execution."๋ผ๊ณ  ์„ค๋ช…ํ•˜๊ณ  ์žˆ๋‹ค fixedDelay๋Š” ํ•œ ๋ฒˆ ์‹คํ–‰์ด ๋๋‚œ ์‹œ์ ๊ณผ ๋‹ค์Œ ์‹คํ–‰์ด ์‹œ์ž‘๋˜๋Š” ์‹œ์  ์‚ฌ์ด์— 5์ดˆ ๊ฐ„๊ฒฉ์œผ๋กœ ๋ณด์žฅํ•œ๋‹ค๋Š” ๋ง์ด๋‹ค

@Scheduled(fixedDelay = 5000)
public void cleanup() {
    // ์ž‘์—… ์‹คํ–‰
}
12:00:00 ์ž‘์—… ์‹œ์ž‘
12:00:03 ์ž‘์—… ๋
5์ดˆ ๊ธฐ๋‹ค๋ฆผ
12:00:08 ๋‹ค์Œ ์ž‘์—… ์‹œ์ž‘

์žฅ์ 

์ด์ „ ์ž‘์—…์ด ๋๋‚œ ๋’ค ๋‹ค์Œ ์ž‘์—…์ด ์‹œ์ž‘๋˜๋Š” ๊ฑฐ๋ผ ์•ˆ์ „ํ•˜๋‹ค ์ž‘์—… ์‹œ๊ฐ„์ด ๊ธธ์–ด์ ธ๋„ ๋๋‚˜๊ณ  ๋‚˜์„œ ๋‹ค์‹œ ์‹œ์ž‘์ด๋ผ๋Š” ํ๋ฆ„์ด ๋œ ๊ผฌ์ด๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค

๋‹จ์ 

์ •ํ™•ํžˆ ๋งค 5์ดˆ ๋งค 1๋ถ„ ๊ฐ™์€ ๊ณ ์ •์‹œ๊ฐ์„ ๋ณด์žฅํ•˜์ง€๋Š” ์•Š๋Š”๋‹ค

์ž‘์—… ์‹œ๊ฐ„์ด ๊ธธ์–ด์ง€๋ฉด ์ „์ฒด ์‹คํ–‰ ๊ฐ„๊ฒฉ๋„ ๋ฐ€๋ฆฐ๋‹ค

์ž‘์—… 3์ดˆ + ๋Œ€๊ธฐ 5์ดˆ = ๋‹ค์Œ ์‹คํ–‰์€ 8์ดˆ ๋’ค
์ž‘์—… 10์ดˆ + ๋Œ€๊ธฐ 5์ดˆ = ๋‹ค์Œ ์‹คํ–‰์€ 15์ดˆ ๋’ค

 

์–ธ์ œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒŒ ์ ์ ˆํ• ๊นŒ? ํ–ˆ์„ ๋• ์™ธ๋ถ€ API๋™๊ธฐํ™”, ํŒŒ์ผ ์ •๋ฆฌ, DB์ •ใ„น, ๋ฉ”์ผ ์žฌ์‹œ๋„, ๋กœ๊ทธ ์ •๋ฆฌ ๋“ฑ์— ์ ์ ˆํ•ด ๋ณด์ธ๋‹ค

 

2. fixedRate

fixedRate๋Š” ์ž‘์—… ์‹œ์ž‘ ์‹œ๊ฐ์„ ๊ธฐ์ค€์œผ๋กœ ์ผ์ • ๊ฐ„๊ฒฉ๋งˆ๋‹ค ์‹คํ–‰ํ•˜๋ ค๋Š” ๋ฐฉ์‹์ด๋‹ค

@Scheduled(fixedRate = 5000)
public void collectMetrics() {
    // ์ž‘์—… ์‹คํ–‰
}

๊ณต์‹๋ฌธ์„œ์—์„œ fixedRate๋„ ์ฃผ๊ธฐ ์‹คํ–‰ ์†์„์œผ๋กœ ์ œ์‹œ๋˜๊ณ  ์žˆ๋‹ค Spring @Scheduled javadoc์€ ๋ฐ˜๋ณต ์ž‘์—…์—์„œ cron, fixedDelay, fixedRate ์ค‘ ํ•˜๋‚˜๋ฅผ ์ง€์ •ํ•œ๋‹ค๊ณ  ์„ค๋ช…ํ•œ๋‹ค 

12:00:00 ์ž‘์—… ์‹œ์ž‘
12:00:05 ๋‹ค์Œ ์ž‘์—… ์‹œ์ž‘ ์˜ˆ์ •
12:00:10 ๋‹ค์Œ ์ž‘์—… ์‹œ์ž‘ ์˜ˆ์ •

์ฆ‰, ์‹œ์ž‘ ๊ธฐ์ค€์œผ๋กœ 5์ดˆ๋งˆ๋‹ค๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ์ดํ•ดํ•˜๊ธฐ ์‰ฝ๋‹ค

์žฅ์ 

์ผ์ •ํ•œ ์ฃผ๊ธฐ๋กœ ๊ณ„์† ์‹คํ–‰ํ•˜๋ ค๋Š” ์ž‘์—…์— ์ข‹๋‹ค ์˜ˆ๋ฅผ๋“ค์–ด 10์ดˆ๋งˆ๋‹ค ํ˜„์žฌ ์„œ๋ฒ„ ์ƒํƒœ๋ฅผ ์ˆ˜์ง‘ํ•˜๊ธฐ ๊ฐ™์€ ๊ฑด ์‹œ์ž‘ ๊ฐ„๊ฒฉ์ด ์ค‘์š”ํ•˜๋‹ค

๋‹จ์ 

์ž‘์—…์ด ์˜ค๋ž˜ ๊ฑธ๋ฆฌ๋ฉด ๋ฐ€๋ฆฌ๊ฑฐ๋‚˜ ๊ฒน์นจ ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธธ ์ˆ˜ ์žˆ๋‹ค

Spring ๊ณต์‹๋ฌธ์„œ๋Š” ๊ฐ™์€ ๋ฉ”์„œ๋“œ์— ์—ฌ๋Ÿฌ ์Šค์ผ€์ค„ ์„ ์–ธ์ด ์žˆ์œผ๋ฉด ๋…๋ฆฝ์ ์œผ๋กœ ์ฒ˜๋ฆฌ๋˜๊ณ  ์„œ๋กœ ๊ฒน์ณ ๋ณ‘๋ ฌ ์‹คํ–‰๋˜๊ฑฐ๋‚˜ ๋ฐ”๋กœ ์ด์–ด ์‹คํ–‰๋  ์ˆ˜ ์žˆ์œผ๋‹ˆ ๊ฒน์น˜์ง€ ์•Š๊ฒŒ ์ฃผ์˜ํ•˜๋ผ๊ณ  ๋งํ•˜๊ณ  ์žˆ๋‹ค

"such co-located schedules may overlap and execute multiple times in parallel or in immediate succession"

 

์–ธ์ œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒŒ ์ ์ ˆํ• ๊นŒ? ํ–ˆ์„ ๋• 10์ดˆ๋งˆ๋‹ค ๋ฉ”ํŠธ๋ฆญ ์ˆ˜์ง‘, 1๋ถ„๋งˆ๋‹ค ์ƒํƒœ ์ฒดํฌ, ์ผ์ •์ฃผ๊ธฐ๋กœ ์บ์‹œ ๊ฐฑ์‹  ์‹œ๋„ ๋“ฑ์— ์ ์ ˆํ•ด ๋ณด์ธ๋‹ค

 

3. cron

๋ช‡ ์ดˆ, ๋ช‡ ๋ถ„, ๋ช‡ ์‹œ, ๋ช‡ ์ผ, ๋ช‡ ์›”, ๋ฌด์Šจ ์š”์ผ์— ์‹คํ–‰ํ• ์ง€๋ฅผ ์‹์œผ๋กœ ์ •๋ฆฌํ•˜๋Š” ๋ฐฉ์‹์ด๋‹ค

@Scheduled(cron = "0 0 3 * * *")
public void cleanupOldTempFiles() {
    // ๋งค์ผ ์ƒˆ๋ฒฝ 3์‹œ ์‹คํ–‰
}

" A well-formed cron expression, such as * * * * * *, consists of six space-separated time and date fields, each with its own range of valid values. " Spring ๊ณต์‹๋ฌธ์„œ๋Š” cron ํ‘œํ˜„์‹์ด ์ •ํ•ด์ง„ ํ˜•์‹์„ ๋”ฐ๋ผ์•ผ ํ•œ๋‹ค๊ณ  ์„ค๋ช…ํ•˜๊ณ  ์žˆ๋‹ค

cron ํ‘œํ˜„์‹์€ 6๊ฐœ์˜ ์นธ์œผ๋กœ ํ‘œํ˜„๋œ๋‹ค๋Š” ๋ง์ด๋‹ค

์ดˆ ๋ถ„ ์‹œ ์ผ ์›” ์š”์ผ
0  0  3  *  *  * -> ๋งค์ผ 03:00:00

์žฅ์ 

์‚ฌ๋žŒ์ด ์ดํ•ดํ•˜๊ธฐ ์‰ฌ์šด ์šด์˜ ์‹œ๊ฐ„ ๊ธฐ์ค€์œผ๋กœ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค

์˜ˆ๋ฅผ๋“ค์–ด ๋งค์ผ ์ƒˆ๋ฒฝ3์‹œ, ๋งค์ฃผ ์›”์š”์ผ ์˜ค์ „ 9์‹œ, ๋งค๋‹ฌ 1์ผ 0์‹œ, ํ‰์ผ 18์‹œ.

์ด๋Ÿฐ ์‹์˜ ๋‹ฌ๋ ฅ ๊ธฐ์ค€ ์ž‘์—…์— ์ข‹๋‹ค

๋‹จ์ 

ํ‘œํ˜„์‹์ด ์ต์ˆ™ํ•˜์ง€ ์•Š์œผ๋ฉด ํ—ท๊ฐˆ๋ฆฐ๋‹ค

0 0 3 * * *

์ฒ˜์Œ๋ณด๋ฉด ๋ญ” ์†Œ๋ฆฐ์ง€ ๋ชจ๋ฅธ๋‹ค 

๋‘๋ฒˆ์งธ๋กœ, ์ž‘์—…์ด ์˜ค๋ž˜ ๊ฑธ๋ฆด ๊ฒฝ์šฐ ๋‹ค์Œ ์‹คํ–‰ ์‹œ์ ๊ณผ ๊ฒน์น  ์ˆ˜ ์žˆ๋Š”์ง€ ๊ณ ๋ คํ•ด์•ผ ํ•œ๋‹ค ํŠนํžˆ ์„œ๋ฒ„๊ฐ€ ์—ฌ๋Ÿฌ๋Œ€๋ฉด ์ค‘์š”ํ•ด์ง„๋‹ค

์„œ๋ฒ„ 1๋Œ€ → ์ƒˆ๋ฒฝ 3์‹œ์— 1๋ฒˆ ์‹คํ–‰
์„œ๋ฒ„ 2๋Œ€ → ๊ฐ ์„œ๋ฒ„์—์„œ ์ƒˆ๋ฒฝ 3์‹œ์— ์‹คํ–‰๋  ์ˆ˜ ์žˆ์Œ

EC2 ํ•œ ๋Œ€๋ฉด ๋‹จ์ˆœํ•˜์ง€๋งŒ, ๋‚˜์ค‘์— ์„œ๋ฒ„๊ฐ€ ์—ฌ๋Ÿฌ ๋Œ€๊ฐ€ ๋˜๋ฉด ์ค‘๋ณต ์‹คํ–‰ ๋ฐฉ์ง€๋„ ๊ณ ๋ฏผํ•ด์•ผ ํ•œ๋‹ค

 

์–ธ์ œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒŒ ์ ์ ˆํ• ๊นŒ? ๋ผ๊ณ  ํ–ˆ์„ ๋• ์ •ํ•ด์ง„ ์‹œ๊ฐ์— ์‹คํ–‰ํ•ด์•ผ ํ•˜๋Š” ์šด์˜ ์ž‘์—…์ธ ๊ฒฝ์šฐ์— ์ ์ ˆํ•ด ๋ณด์ธ๋‹ค

 

4. initialDelay

initialDelay๋Š” ์„œ๋ฒ„ ์ผœ์ง„ ๋’ค ๋ฐ”๋กœ ์‹คํ–‰ํ•˜์ง€ ๋ง๊ณ  ์ฒ˜์Œ ์‹คํ–‰๋งŒ ์กฐ๊ธˆ ๋Šฆ์ถ”๋Š” ์˜ต์…˜์ด๋‹ค

@Scheduled(initialDelay = 10000, fixedDelay = 60000)
public void cleanup() {
    // ์„œ๋ฒ„ ์‹œ์ž‘ 10์ดˆ ํ›„ ์ฒซ ์‹คํ–‰
    // ์ดํ›„ ์ด์ „ ์ž‘์—… ์ข…๋ฃŒ ํ›„ 60์ดˆ๋งˆ๋‹ค ์‹คํ–‰
}

๊ณต์‹๋ฌธ์„œ javadoc์€ initialDelay๋ฅผ ์ด๋ ‡๊ฒŒ ์„ค๋ช…ํ•˜๊ณ  ์žˆ๋‹ค

"Number of units of time to delay before the first execution" ์ฒซ๋ฒˆ์งธ ์‹คํ–‰ ์ „์— ์–ผ๋งˆ๋‚˜ ๊ธฐ๋‹ค๋ฆด์ง€ ์ •ํ•˜๋Š” ๊ฐ’์ด๋ผ๋Š” ๋œป์ด๋‹ค

https://github.com/spring-projects/spring-framework/blob/main/spring-

context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java

 

spring-framework/spring-context/src/main/java/org/springframework/scheduling/annotation/Scheduled.java at main · spring-project

Spring Framework. Contribute to spring-projects/spring-framework development by creating an account on GitHub.

github.com

 

 

์žฅ์ 

์„œ๋ฒ„ ์‹œ์ž‘ ์งํ›„ ๋ฌด๊ฑฐ์šด ์ž‘์—…์ด ๋ฐ”๋กœ ๋„๋Š” ๊ฑธ ๋ง‰์„ ์ˆ˜ ์žˆ๋‹ค

์„œ๋ฒ„๊ฐ€ ๋ง‰ ์ผœ์ ธ์žˆ์„ ๋•Œ๋Š” ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ดˆ๊ธฐํ™”, DB ์—ฐ๊ฒฐ, ์บ์‹œ ์ค€๋น„ ๋“ฑ์œผ๋กœ ๋ฐ”์  ์ˆ˜ ์žˆ๋”ฐ ๊ทธ๋•Œ ์Šค์ผ€์ค„๋Ÿฌ๊นŒ์ง€ ๋ฐ”๋กœ ๋Œ๋ฉด ๋ถ€๋‹ด์ด ๋  ์ˆ˜ ์žˆ๋‹ค

๋‹จ์ 

๋‹จ๋…์œผ๋กœ ๋ฐ˜๋ณต ์ฃผ๊ธฐ๋ฅผ ์ •ํ•˜๋Š” ํ•ต์‹ฌ ๋ฐฉ์‹์€ ์•„๋‹ˆ๋‹ค ๋Œ€๋ถ€๋ถ„ fixedDelay๋‚˜ fixedRate์™€ ๊ฐ™์ด ์“ด๋‹ค

 

 

๋ฐฉ์‹ ๊ธฐ์ค€ ์žฅ์  ๋‹จ์  ์–ด์šธ๋ฆฌ๋Š” ์ž‘์—…
fixedDelay ์ด์ „ ์ž‘์—…
์ข…๋ฃŒ ํ›„
์ด์ „ ์ž‘์—… ๋๋‚œ ๋’ค ์‹คํ–‰์ด๋ผ
์•ˆ์ „ํ•จ
์ •ํ™•ํ•œ ์‹œ๊ฐ ์‹คํ–‰์€ ์•„๋‹˜ ํŒŒ์ผ ์ •๋ฆฌ, ์žฌ์‹œ๋„,
DB ์ •๋ฆฌ
fixedRate ์ด์ „ ์ž‘์—…
์‹œ์ž‘ ํ›„
์ผ์ • ์ฃผ๊ธฐ๋กœ ์‹คํ–‰ํ•˜๋ ค ํ•  ๋•Œ ์ข‹์Œ ์ž‘์—…์ด ์˜ค๋ž˜ ๊ฑธ๋ฆฌ๋ฉด ๋ฐ€๋ฆผ/๊ฒน์นจ ๊ณ ๋ ค ๋ฉ”ํŠธ๋ฆญ ์ˆ˜์ง‘, ์ƒํƒœ ์ฒดํฌ
cron ๋‹ฌ๋ ฅ/์‹œ๊ฐ ๋งค์ผ 3์‹œ ๊ฐ™์€ ์šด์˜ ์‹œ๊ฐ„ ์„ค์ •
๊ฐ€๋Šฅ
ํ‘œํ˜„์‹์ด ํ—ท๊ฐˆ๋ฆฌ๊ณ  ์ค‘๋ณต ์‹คํ–‰ ๊ณ ๋ ค
ํ•„์š”
์ƒˆ๋ฒฝ ์ •๋ฆฌ, ํ†ต๊ณ„, ์ •์‚ฐ
initialDelay ์ฒซ ์‹คํ–‰ ์ „ ์„œ๋ฒ„ ์‹œ์ž‘ ์งํ›„ ๋ถ€๋‹ด ๋ฐฉ์ง€ ๋ฐ˜๋ณต ๋ฐฉ์‹ ์ž์ฒด๋Š” ์•„๋‹˜ fixedDelay,
fixedRate ๋ณด์กฐ

 

'Backend > ๐ŸŒฑ Spring' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

Spring๊ณผ SpringBoot  (0) 2026.05.05
GlobalException & ErrorException  (0) 2026.01.12
MVC(Modelโ€“Viewโ€“Controller)  (0) 2026.01.12
Spring Bean ์ƒ๋ช… ์ฃผ๊ธฐ  (1) 2026.01.12
[Spring]API ๋กœ๊น…  (0) 2025.08.21