SW개발/Spring Framework

Spring 종료 전 호출

개소왕 2018. 8. 21. 17:19


* 개요

- 스프링이 갑자기 종료될 때 버퍼에 보관하고 있던 데이터를 DB 로 영속화 하는 코드를 짜고 싶어

- 스프링 종료 전 특정 메서드 호출하는 방법


* @PreDestroy

https://www.mkyong.com/spring/spring-postconstruct-and-predestroy-example/



* 기타 

- destroy() 

- 자바 소별자 finalize() 는 안됨


* 참고

스프링 라이프사이클

https://blog.outsider.ne.kr/766

ㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴㄴ