Results 1 to 2 of 2

Thread: Web.xml

  1. #1
    Join Date
    Feb 2007
    Posts
    4

    Question Web.xml

    Say i initialize the spring IOC container in web.xml as follows..
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    some files
    </param-value>
    </context-param>

    So now exactly what does this give me? How can i get a reference to any of the objects in the container? How can i get the factory to make retrieve the beans?

    I see you can kind of use the contextsingletonbeanfactory in this fashion..
    BeanFactoryLocator bfLocator = ContextSingletonBeanFactoryLocator.getInstance();
    BeanFactoryReference bfReference = bfLocator.useBeanFactory("examples.spring");
    BeanFactory factory = bfReference.getFactory();
    Object o = factory.getBean("whatever")

    But that still requires me to create a managed bean in some .xml file with the id of "examples.spring" that has all of the configuration files. But why do i duplicate the name of the .xml files to use.. once in this .xml file and once in web.xml?

    What are the benifets of initializing the IOC container in web.xml if i just have to use initialize it programatacilly to do anything with it.

  2. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

Posting Permissions

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