1. Implement InitializingBean interface in your class.
class MyBean implements InitializingBean {
public void afterPropertiesSet() throws Exception {
System.out.println("my bean is ready");
}
}
2. Use annotation @PostConstruct in your class. Don't forget to use also <annotation-config></annotation-config> in your application context.class MyBean {
@PostConstruct
public void initMethod() throws Exception {
System.out.println("my bean is ready");
}
}
3. Use init method xml attribute. class MyBean {
public void initMethod() throws Exception {
System.out.println("my bean is ready");
}
}
0 comments:
Post a Comment