SimpleBean.java
InitializingBean接口中只有一个afterPropertiesSet方法











































配置文件:




















测试代码:




































运行结果:
this is info from afterpropertiesSet from SimpleBean and property is name:gaoxiang
this is info from constructor from SimpleBean and property is name:gaoxiang
可以看initializingBean的生命周期是设置属性之后,自定义init-method之前运行
这种方式的好处是一次就能为bean的所有实例指定初始化回调,代价是应用程序和spring耦合