BeanPostProcessor won't ever get proxied bean in case of circular references in the bean [SPR-13163] #17754
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: bulk-closed
An outdated, unresolved issue that's closed in bulk as part of a cleaning process
Jan Novotný opened SPR-13163 and commented
BeanPostProcessors will obtain reference to unwrapped bean instead of proxy class that handles (for example) transaction attributes of the bean. This happens only for beans that have circular bean references in them.
Steps to reproduce:
One of the beans will come as proxy to the post processor, the other one in unwrapped shape. This happens despite of BeanFactory has both beans in singletons repository proxied.
Workaround for this bug is to pass BeanFactory to the BeanPostProcessor class and do this:
{{
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
if(bean instanceof PublicInterface) {
Advised proxy = beanFactory.getBean(beanName, Advised.class);
}
return bean;
}}}
Affects: 4.1.6
Attachments:
The text was updated successfully, but these errors were encountered: