Announcement Announcement Module
No announcement yet.
contextLoader and import tag Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • contextLoader and import tag


    I have broken up my spring config into separate XML files. The applicationContext-scheduledjobs.xml file has a dependency on the beans defined inside applicationContext-hibernate.xml.....


    (I am using Tomcat 5 BTW)

    So I tried listing the xml files in order, hoping that the files would be parsed in that order... and great... they do!

    But I keep getting this error message saying Spring cannot find the dependant bean (even though I know it is parsed and initialised it):

    An element with the identifier "mailMessage" must appear in the document.

    So, I next try using the import tag, and try importing applicationContext-hibernate.xml from the applicationContext-schedulejobs.xml file, (I tried leaving the applicationContext-hibernate.xml file defined in the contextLoaderParam and not defined in the contextLoaderParam, but neither worked) and I get the same error....

    The reason I need them to be separate, is that I am using Quartz scheduler, and I have two servers. I only want one server to have the Cron Trigger bean definition (else they both do the work!)... The only other solution I can think of at the momment, is putting all definitions in the one file, and maintaining two different versions of the file, one with the quartz definition, and the other one without it... but this is not ideal...

    I am using Spring 1.2.4.... (but I did not see anything in the 1.2.5 changelog relating to this area)

    Any ideas as to what else I can try?

  • #2
    are you using by any change ref local instead of ref? ref local requires the bean definition to be in the same file.


    • #3
      I changed ref local="mailMessage" to ref bean="mailMessage" and everything now works fine....

      Thank you!