Announcement Announcement Module
Collapse
No announcement yet.
Order of loading context xml files Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Order of loading context xml files

    Hi All,

    I have multiple spring context files with beans declared in it.Some of the beans declared are interdependent between the XMLs. For example there is a bean declared in contextfile A is given as a reference on a contextxml file B.

    The context files are present in META-INF/spring folder as I am deploying that as a OSGi bundle in virgo server.

    My question is

    How spring decides on the order of loading the the xml files?

    I faced an error (bean reference error) while deploying this to one of the virgo server and no error on the 2nd instance of the virgo server.

    I used import to load the context files in the order i prefer and that eliminated the error.

    Will using "depends-on" attribute while declaring the beans solve the error with multiple context xml files?

    Any suggestions on this is appreciated.

    Thanks

  • #2
    Spring reference does a pretty good job explaining it. Often times its not necessary as spring is able to figure out dependencies on its own or by using the ref attribute.

    http://static.springsource.org/sprin...tory-dependson

    Comment


    • #3
      Thanks for your reply... any idea how spring does it on its own.. like it should have some kind of algorithm it should be following to load the beans from the context files.

      I would like to have an idea on it.Will try to google it and see if i can get anything on that.

      Regards

      Comment

      Working...
      X