Announcement Announcement Module
Collapse
No announcement yet.
multiple .xml files for beans definitions Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • multiple .xml files for beans definitions

    Hello there,
    In order to test my UI I am defining "mocked" beans for my BO. Right now I have all this beans defined in the myapp-servlet.xml file and they are cluttering the file, making it dificult to find the real thing.
    I tried moving all this beans to anothe xml file but spring does not find them.
    Is there a way to achieve this?

    Thanks.

    Erick

  • #2
    You can certainly have bean definitions in separate XML files, by adding the following lines to your web.xml:

    Code:
      <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
          WEB-INF/whatever-path-to-xml/whatever-name.xml
          WEB-INF/whatever-path-to-xml/another-name.xml
        </param-value>
      </context-param>
    You only need to modify the XML file paths according to your needs, and you can have more than two of them. Spring's ContextLoader uses this parameter to initialize the application context.

    Comment


    • #3
      Thank you very much Lawrence.
      I did id and it is working neatly.

      Cheers,
      Erick.

      Comment

      Working...
      X