kaka09
스프링(spring) 빈 생명주기 본문
사용법
..... 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(){
}