Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postProcessBeforeInstantiation这个返回null,是不是代表一直没有代理对象? #7

Open
yftan opened this issue Jan 8, 2021 · 1 comment

Comments

@yftan
Copy link

yftan commented Jan 8, 2021

分支: populate-proxy-bean-with-property-values
postProcessBeforeInstantiation这个函数代理里面注释是如果这个类存在代理就返回代理,但是进来发现不论什么类进来最后都返回都是null。
@OverRide
public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
return null;
}

@DerekYRC
Copy link
Owner

DerekYRC commented Jan 8, 2021

分支: populate-proxy-bean-with-property-values
postProcessBeforeInstantiation这个函数代理里面注释是如果这个类存在代理就返回代理,但是进来发现不论什么类进来最后都返回都是null。
@OverRide
public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
return null;
}

返回代理对象的逻辑在populate-proxy-bean-with-property-values分支迁移到postProcessAfterInitialization方法了。spring源码中,postProcessBeforeInstantiation方法如果返回bean的话,会造成“短路”,不会执行后面的逻辑,现在还没有看到postProcessBeforeInstantiation方法的实际用处。

@DerekYRC DerekYRC closed this as completed Jan 9, 2021
@DerekYRC DerekYRC reopened this Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants