티스토리 뷰
Web 응용프로그램들을 개발하다보면 항상 스케쥴 관련으로 무언가를 해야 할 때가 있는데
프로그램 제작은 귀찮고.. 셋팅도 귀찮고.. 그렇다면 그냥 기존 프로젝트에다가 스케쥴러를 만들어 버리자!
StaticsSchedule.java
@Component
public class StaticsSchedule {
private static final Logger LOGGER = LoggerFactory.getLogger(StaticsSchedule.class);
//매일 오전 8시 30분 실행
@Scheduled(cron = "0 30 8 * * *")
public void staticsCount()
{
try {
LOGGER.info("통계 관련 1일 스케쥴러 실행");
//To-do
} catch (Exception e) {
LOGGER.error("통계 관련 1일 스케쥴러 에러");
e.printStackTrace();
}
}
}
dispatcher-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
">
<!-- 스케쥴러 -->
<bean id="staticsSchedule " class="com.commom.Scheduler.StaticsSchedule" />
<task:scheduler id="gsScheduler" pool-size="10" />
<task:executor id="gsTaskExecutor" pool-size="10" />
<task:annotation-driven executor="gsTaskExecutor" scheduler="gsScheduler" />
- Total
- Today
- Yesterday
- polyfill
- canvas
- Oracle
- 현재시간
- ORA-01031
- 컬럼 코멘트
- html 출력
- Scheduled
- 180일
- Java
- 테이블 코멘트
- password
- 오라클
- spring
- 데이터 명세서
- 비밀번호
- job
- JavaScript
- Raphael
- 스키마 테이블
- scheduler
- mariadb
- 토픽맵
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |