invokeInitMethods中缺少二次初始化的判断
stanoswald opened this issue · 0 comments
stanoswald commented
AbstractAutowireCapableBeanFactory
类中的invokeInitMethods
函数应该像适配器的destroy
函数一样,提供同时实现接口DisposableBean
和添加至xml配置文件destroy-method
时的判断。
参考适配器DisposableBeanAdapter
的源码,是否应该将invokeInitMethods
中的if条件修改如下?
if (StrUtil.isNotEmpty(initMethodName) && !(bean instanceof InitializingBean && "afterPropertiesSet".equals(initMethodName)))
书P92的注释不正确,为了避免二次销毁 应改为 为了避免二次初始化,但源码看起来已经更正了。