appCtx.registerBeanDefinition(newBeanName, copiedBeanDefinition);
return copiedBeanDefinition;
}
private void replaceWithScopedProxy(BeanDefinitionRegistry appCtx, String beanName, String targetBeanName) {
BeanConfiguration scopedProxy = new DefaultBeanConfiguration(ScopedProxyFactoryBean.class);
scopedProxy.addProperty("targetBeanName", targetBeanName);
BeanDefinition scopedBeanDefinition = scopedProxy.getBeanDefinition();
appCtx.registerBeanDefinition(beanName, scopedBeanDefinition);
}