Announcement Announcement Module
No announcement yet.
How to handle rerferences in custom XML config Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to handle rerferences in custom XML config

    We are using Spring's custom XML configuration handling, which has been working great for most of our use cases, however I'm not quite sure how to implement the following.

    We have a bean, A, that can take a list of Z beans. The definitions for Z, within A, may either be a complete definition or a reference to a Z bean defined in a broader scope. For example:

    <a id="foo">
      <z id="bar" />
      <z ref="baz" />
    In my custom bean definition parser, either for A or Z, how would I handle the reference? It's possible, though unlikely, that the bean definition for the referent has not been created yet, so I don't think I can use a lookup in the BeanRegistry. Should I instead use org.springframework.beans.factory.config.RuntimeBe anReference? I was concerned that this wouldn't do what I wanted because it wasn't a BeanDefinition.