스프링(15)
-
스프링부트 jxls 엑셀 탬플릿 이용하여 만들기
dependency 추가 implementation 'org.jxls:jxls:2.12.0' implementation 'org.jxls:jxls-poi:2.12.0' implementation 'org.apache.poi:poi:5.2.2' implementation 'org.apache.poi:poi-ooxml:5.2.2' jxls 1.x 버전을 사용하지 않고 2.x로 구현했다. poi 라이브러리도 사용하기 때문에 poi도 추가해줘야 한다. @GetMapping("/excel.json") public void excel(JavaBean bean, HttpSession session, HttpServletResponse res) throws IOException, InvalidFormatExceptio..
2022.10.06 -
스프링부트 cron 표현식 연도 생략 해야함 주의!
Example patterns: "0 0 * * * *" = the top of every hour of every day. "*/10 * * * * *" = every ten seconds. "0 0 8-10 * * *" = 8, 9 and 10 o'clock of every day. "0 0 6,19 * * *" = 6:00 AM and 7:00 PM every day. "0 0/30 8-10 * * *" = 8:00, 8:30, 9:00, 9:30, 10:00 and 10:30 every day. "0 0 9-17 * * MON-FRI" = on the hour nine-to-five weekdays "0 0 0 25 12 ?" = every Christmas Day at midnight 스프링부트..
2022.09.26 -
스프링부트 스케줄러 동적 처리
@Slf4j @Component public class DynamicChangeScheduler { private ThreadPoolTaskScheduler scheduler; private String cron; private AnnualFeeService annualFeeService; // 생성자 주입을 통해 db의 자동갱신 기준일 cron 값 가져옴 public DynamicChangeScheduler(AnnualFeeService annualFeeService) { this.annualFeeService = annualFeeService; List list = annualFeeService.list(); cron = list.get(0).getCron(); } // 스케줄러 시작 public v..
2022.09.26