▶ 사용할 Quartz Scheduler 서비스를 사용하기 위해 Bean 등록을 해줍니다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
    <bean name="dummyJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean" 
          p:jobClass="com.gm.crawling.product.controller.MyAbstractJob"
          p:durability="true">
        <property name="jobDataAsMap">
            <map>
                <entry key="HelloJob" value-ref="HelloJob"/>
            </map>
        </property>
    </bean>
    
    <bean name="mailJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean"
          p:jobClass="com.gm.crawling.product.controller.MailJob"
          p:durability="true">
        <property name="jobDataAsMap">
            <map>
                <entry key="HelloJob" value-ref="HelloJob"/>
            </map>
        </property>
    </bean>
 
    <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"
          p:jobDetail-ref="dummyJob"
          p:startDelay="1000"
          p:cronExpression="0/30 * * * * ?"/>
          
     <bean id="mailTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"
          p:jobDetail-ref="mailJob"
          p:startDelay="1000"
          p:cronExpression="0/5 * * * * ?"/>
 
    <bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
        <property name="triggers">
            <list>
                <ref bean="cronTrigger"/>
                <ref bean="mailTrigger"/>
            </list>
        </property>
    </bean
cs


Quartz CronTrigger로 알아보는 Cron 표현식


+ Recent posts