refined sequence of registration calls

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1035 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller 2009-04-20 11:20:01 +00:00
parent ba2fe0879a
commit 9ef50ddc98
1 changed files with 9 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2007 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -44,15 +44,18 @@ class ScopedProxyBeanDefinitionDecorator implements BeanDefinitionDecorator {
if (node instanceof Element) { if (node instanceof Element) {
Element ele = (Element) node; Element ele = (Element) node;
if (ele.hasAttribute(PROXY_TARGET_CLASS)) { if (ele.hasAttribute(PROXY_TARGET_CLASS)) {
proxyTargetClass = Boolean.valueOf(ele.getAttribute(PROXY_TARGET_CLASS)).booleanValue(); proxyTargetClass = Boolean.valueOf(ele.getAttribute(PROXY_TARGET_CLASS));
} }
} }
// Register the original bean definition as it will be referenced by the scoped proxy and is relevant for tooling (validation, navigation). // Register the original bean definition as it will be referenced by the scoped proxy
// and is relevant for tooling (validation, navigation).
BeanDefinitionHolder holder =
ScopedProxyUtils.createScopedProxy(definition, parserContext.getRegistry(), proxyTargetClass);
String targetBeanName = ScopedProxyUtils.getTargetBeanName(definition.getBeanName()); String targetBeanName = ScopedProxyUtils.getTargetBeanName(definition.getBeanName());
parserContext.getReaderContext().fireComponentRegistered(new BeanComponentDefinition(definition.getBeanDefinition(), targetBeanName)); parserContext.getReaderContext().fireComponentRegistered(
new BeanComponentDefinition(definition.getBeanDefinition(), targetBeanName));
return ScopedProxyUtils.createScopedProxy(definition, parserContext.getRegistry(), proxyTargetClass); return holder;
} }
} }