refined sequence of registration calls

This commit is contained in:
Juergen Hoeller
2009-04-20 11:20:01 +00:00
parent 9306d6dbaa
commit e54a44b577

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;
} }
} }