Java:Spring Bean注入点

1. 实现org.springframework.beans.factory.InitializingBean接口,可以注册bean.

java

public class AnotherExampleBean implements InitializingBean {

    public void afterPropertiesSet() {
        // do some initialization work
    }
}

1.1 实现org.springframework.beans.factory.DisposableBean接口,可以在bean销毁前执行某些操作.

public class AnotherExampleBean implements DisposableBean {

    public void destroy() {
        // do some destruction work (like releasing pooled connections)
    }
}

2. 实现ApplicationContextAware 或者 BeanNameAware 接口.

3. 其他Ware接口

Spring 其他Ware接口

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

*

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据