Results 1 to 3 of 3

Thread: multiple .xml files for beans definitions

  1. #1
    Join Date
    Jan 2005
    Location
    Toronto, Canada
    Posts
    34

    Default 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
    Erick Dovale

  2. #2
    Join Date
    Aug 2004
    Location
    Hong Kong
    Posts
    26

    Default

    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.

  3. #3
    Join Date
    Jan 2005
    Location
    Toronto, Canada
    Posts
    34

    Default

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

    Cheers,
    Erick.
    Erick Dovale

Similar Threads

  1. Replies: 6
    Last Post: Sep 1st, 2005, 09:18 AM
  2. Replies: 2
    Last Post: Jul 29th, 2005, 11:52 AM
  3. Replies: 7
    Last Post: Jul 26th, 2005, 02:48 PM
  4. Unexpected behaviour with multiple config files
    By rgitzel in forum Container
    Replies: 7
    Last Post: Mar 8th, 2005, 07:11 PM
  5. Replies: 0
    Last Post: Nov 3rd, 2004, 05:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •