Object scopedInstance = scope.get(beanName, () -> {
beforePrototypeCreation(beanName);
try {
return createBean(beanName, mbd, args);
}
finally {
afterPrototypeCreation(beanName);
}
});
翔仔老师,这个匿名类,我只知道是ObjectFactory的实现类,但是看不懂这几行代码啥意思,
beforePrototypeCreation(beanName) |
createBean(beanName, mbd, args) |
afterPrototypeCreation(beanName) 这三个方法不是都在AbstractBeanFactory类里面吗,为什么匿名类可以这样直接调用?是不是说这个匿名类,同时实现了ObjectFactory 和 AbstractBeanFactory ,然后在ObjectFactory#getObject中调用了上述的三个方法呢?我要咋验证这段代码的效果呢
登录后可查看更多问答,登录/注册