use of org.camunda.bpm.engine.spring.components.aop.util.Scopifier in project camunda-bpm-platform by camunda.
the class ProcessScope method postProcessBeanFactory.
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
beanFactory.registerScope(ProcessScope.PROCESS_SCOPE_NAME, this);
Assert.isInstanceOf(BeanDefinitionRegistry.class, beanFactory, "BeanFactory was not a BeanDefinitionRegistry, so ProcessScope cannot be used.");
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;
for (String beanName : beanFactory.getBeanDefinitionNames()) {
BeanDefinition definition = beanFactory.getBeanDefinition(beanName);
// Replace this or any of its inner beans with scoped proxy if it has this scope
boolean scoped = PROCESS_SCOPE_NAME.equals(definition.getScope());
Scopifier scopifier = new Scopifier(registry, PROCESS_SCOPE_NAME, proxyTargetClass, scoped);
scopifier.visitBeanDefinition(definition);
if (scoped) {
Scopifier.createScopedProxy(beanName, definition, registry, proxyTargetClass);
}
}
beanFactory.registerSingleton(ProcessScope.PROCESS_SCOPE_PROCESS_VARIABLES_SINGLETON, this.processVariablesMap);
beanFactory.registerResolvableDependency(ProcessInstance.class, createSharedProcessInstance());
}
Aggregations