We are using beans instantiated via custom XML elements/schema. We have some nested tags, similar to the example shown in B.7.1 in your documentation.
For parsing the nested tags, however, we do the following
The issue we're seeing is that if another bean is configured to have one of these child beans injected, that child bean seems to be re-instantiated (instead of the instance already injected in the parent bean being used). Is this because the child beans is created as child definition of the parent? if so, is it possible to specifically make those child beans root bean definitions in their own right?
BeanDefinitionParserDelegate delegate = parserContext.getDelegate();
NamespaceHandler handler = delegate.getReaderContext().getNamespaceHandlerResolver().resolve(namespaceUri);
handler.parse(childElement, new ParserContext(delegate.getReaderContext(), delegate, null));