Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
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
more
Archives
Today
Total
관리 메뉴

kaka09

스프링(spring) 빈 생명주기 본문

Web/스프링

스프링(spring) 빈 생명주기

kaka09 2017. 9. 2. 20:03

사용법


..... implements InitializingBean, DisposableBean{

...

}


InitializingBean= 빈 초기화 과정에 호출( ctx.refresh() 과정에서 호출됨)

 

 @Override

public void afterPropertiesSet() thorws Exception {

}



DisposableBean= 빈 소멸과정에 호출( ctx.close() 과정에서 호출됨)


 @override

public void destroy() throws Exception{

}




다른 사용법


@PostConstruct  # 빈 초기화 과정에 호출 ( ctx.refresh() 과정에서 호출됨)

public void initMethod(){

}


@PreDestroy   # 빈 소멸과정에 호출 ( ctx.close() 과정에서 호출됨)

public void destroyMethod(){

}