Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: ApplicationContext hierarchy loaded at application startup

  1. #11
    Join Date
    Jul 2005
    Posts
    1

    Default multiple wars, jars and overriding bean definitions problem

    We're using Spring 1.1.5, and this seemed like an appropriate place to ask, so here goes:

    We're using a single ear, but multiple wars, ejb jars, and dao jars.
    We have adopted a layered approach (dao separate from ejb, etc.), but we're running into that
    "Overriding bean definition message" repeatedly.

    In our packaging scheme, we use a beanRefContext.xml file in each jar. In each jar, the beanRefContext.xml file is actually a ClassPathXmlApplicationContext which pulls in the definitions of the beans, the datasource, and the hibernate sessionFactory. The ClassPathXmlApplicationContext is named according to the jar name (to avoid conflicts).

    Each of the EJBs uses the classpath*:beanRefContext.xml as the BeanFactoryPath. I've toyed with web.xml and its settings for the ContextLoaderListener.

    The documentation on 1.1.5 points out:
    "However, if there are multiple sibling web-apps at the top of the hierarchy, it is problematic to create an ApplicationContext for each web-app which consists of mostly identical bean definitions from lower layers, as there may be issues due to increased memory usage, issues with multiple copies of beans... and possible issues due to side-effects."

    The documentation then suggests using the ContextSingletonBeanFactoryLocator or the SingletonBeanFactoryLocator - but how?

    I quickly tried extending the AbstractStatelessSessionBean to use the ContextSingletonBeanFactoryLocator, but, at first blush, that didn't seem to work.

    Any suggestions?

    Thanks so much (in advance)!

  2. #12
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    You can take a look at the ejbtest integration test app in the autobuilds portion of the Spring CVS tree, for an example of using a shared context from EJBs:

    http://cvs.sourceforge.net/viewcvs.p.../apps/ejbtest/

    Regards,
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

Similar Threads

  1. Replies: 4
    Last Post: Jul 11th, 2005, 12:11 PM
  2. Stack Overflow
    By rayho222 in forum Container
    Replies: 6
    Last Post: May 17th, 2005, 03:42 AM
  3. Questioning the core component
    By Martin Kersten in forum Swing
    Replies: 6
    Last Post: Feb 21st, 2005, 03:45 AM
  4. Replies: 1
    Last Post: Nov 4th, 2004, 09:11 AM
  5. application startup time
    By davidedr in forum Data
    Replies: 1
    Last Post: Sep 1st, 2004, 04:06 PM

Posting Permissions

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