Announcement Announcement Module
Collapse
No announcement yet.
ref bean vs. ref local Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ref bean vs. ref local

    Hi,
    I've spent too much time on an issue with an import in my application context. I imported an applicationContext.xml in my applicationContext.xml file. Now I wanted to refer to the bean I declared in the imported file. I did: <ref local="beanname"/> the bean could not be found. I had to use <ref bean="beanname"/>. This issue was difficult to find because I simply tought that an included file should be referred to as a "local". Don't you agree?

    kind regards,
    Rik

  • #2
    I believe the problem(?) is that "local" is an XML entity, whereas "<import>" is a Spring specific element which simply imports all beans defined in the other file into the current one.

    If "<import" was an XML entity that effectively did nothing more than replace the "<import" element with the contents of the referenced file, then sure, what you are proposing is correct, the entities in the included file would be local. Unfortunately it doesn't work this way.

    As it is, in terms of pure XML, they are two seperate files and are certainly not local to each other.

    Note: If you *did* want to include another *well-formed* xml document, you apparantely can :http://ferret.pmel.noaa.gov/Ferret/L..._includes.html.

    To be honest, at first I thought "<include" was a native XML instruction as well

    I am more than happy to be corrected

    Comment


    • #3
      Thanks for your clearing this up yatesco, it makes sence to me now.

      Comment


      • #4
        Hey, no problem.

        It was either this, or work (only kidding Chris (employer))

        Comment

        Working...
        X