Announcement Announcement Module
Collapse
No announcement yet.
Support For References in the Namespace Extension Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Support For References in the Namespace Extension

    Initially I wrote a custom namespace where there is only one root element in the namespace. This results in quite a large configuration that I would like to break out in separate files. It seemed to me the best way to do it is by adding the ref element extension from the beans schema. No problem there. The context XML and schema were changed to support 2 reference elements. In order to get the schema to work, I had to define 2 additional root elements for the namespace.

    When I run this exception occurs:
    Code:
    Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Cannot locate BeanDefinitionParser for element [application-config]
    As I recall reading, I need 2 more parsers, one for each of the additional root elements.

    I may be going down a path here that will lead nowhere...

    Since the initial root element references the other root elements; the root element parser would need to call the 2 additional parsers.

    I'm not sure if this can be done. If it can be done, I wouldn't know how to control the calling of the parsers.
    Will the spring container just automatically handle this issue?

  • #2
    RE Support For References in the Namespace Extension

    I ventured out and changed the code to run 3 parsers. The parsing of the XML appears to work as expected; however it appears that the Spring container does not do anything to set the references in the higher level bean definitions that are returned from the parsers.

    So it appears that the parsers need to set them. I see a getContainingBeanDefinition() method on the ParserContext. That is all well and good; but it is not clear to me how to set a child bean definition to that containing bean definition. Some documentation on the subject would be helpful...

    Any assistance would be appreciated.
    Thanks in advance...

    Comment


    • #3
      RE Support For References in the Namespace Extension

      Finally figured it out... My thinking was a bit off. It wasn't all that much different than my original solution, only rather than call a function that created the bean definition, called a function that looked up the bean defininition from the registry, based on the ref element... Pretty slick all in all...

      Comment

      Working...
      X