Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 정민이초밥
- 카페
- Java
- SVN사용방법
- 배딩작업
- 나주
- docker
- css
- 광주
- Jsp Pagination
- JavaScript
- 루키초밥
- Eclipse
- 맛집
- mybatis
- 은혜침구
- egov
- ORA-01745
- RefreshableSqlSessionFactoryBean
- 문방구과자
- 반응형앱
- 양동점
- Oracle
- 디카페인
- AbstractViewe
- ORA-01756
- ORA-01005
- Responsively app
- 요리
- ORA-00909
Archives
- Today
- Total
gnusraun
Egov Scheduler 설정 본문
728x90
Egov Scheduler 설정하기
:: pom.xml
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.0</version>
</dependency>
:: context-scheduler.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<!-- 컴포넌트 스캔 -->
<context:component-scan base-package="egovframework.example.cmmn.batch"></context:component-scan>
<!-- quartz 스케줄링 -->
<bean id="schedulerJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<!-- 서비스 구현 객체의 빈 이름을 인자로 줍니다. (ServiceImpl(@Service("")) -->
<property name="targetObject" ref="sayHelloService" />
<!-- 서비스 객체에서 주기적으로 실행될 메소드른 지정합니다. (ServiceImpl(void method()))-->
<property name="targetMethod" value="sayHello" />
<!-- 동시 실행을 방지합니다. -->
<property name="concurrent" value="false" />
</bean>
<!-- 트리거 -->
<bean id="jobTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="jobDetail" ref="schedulerJob" />
<!-- CronTrigger를 사용하여 2분 간격으로 실행되도록 지정했습니다. -->
<property name="cronExpression" value="*/10 * * * * ?" />
</bean>
<!-- 스케줄러 실행 -->
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<!-- 앞에서 설정한 트리거를 등록합니다. 필요하면 여러개 만들어서 등록하면 됩니다. -->
<list>
<ref bean="jobTrigger" />
</list>
</property>
</bean>
</beans>
:: SayHelloService.java
package egovframework.example.cmmn.batch;
public interface SayHelloService {
public void sayHello();
}
:: SayHelloServiceImpl.java
package egovframework.example.cmmn.batch.impl;
import org.springframework.stereotype.Service;
@Service("sayHelloService")
public class SayHelloServiceImpl {
public void sayHello() {
System.out.println("배치스케줄러 정상적으로 동작 완료");
}
}
728x90
'Backend > Egov' 카테고리의 다른 글
Egov org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement (0) | 2023.05.16 |
---|---|
Egov RefreshableSqlSessionFactoryBean 서버 재시작 없이 XML 반영 (0) | 2023.05.14 |
Egov 오라클 연동 (0) | 2023.05.13 |
Egov Pagination 페이지 처리 (0) | 2023.05.13 |
Egov @ResponseBody Ajax 설정 (404 Error 발생) (0) | 2023.05.13 |