# InitializingBean接口
> Spring Bean 实现这个接口,重写afterPropertiesSet方法,这样spring初始化完这个实体类后会调用这个方法
```
@Override
public void afterPropertiesSet() throws Exception {
//TODO something
}
```

# DisposableBean接口

> Spring Bean 实现这个接口, 重写destroy方法,那么Spring在销毁这个bean的时候会自动执行这个方法
```
@Override
public void destroy() throws Exception {
// TODO something
}
```

相关文章:

  • 2021-12-26
  • 2021-06-24
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
猜你喜欢
  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
  • 2021-11-01
  • 2021-07-07
相关资源
相似解决方案