Results 1 to 3 of 3

Thread: The ref element

Hybrid View

  1. #1
    Join Date
    Oct 2004
    Posts
    4

    Default The ref element

    Hi!

    I would like to be able to define an XMLApplicationContext as a bean in another
    XMLApplicationContext. I also want to set this other context as the parent of the first one.
    What I'm looking for I guess is an expansion of the ref element, so I could define my
    ApplicationContext bean like:

    <bean id="myAppContext"
    class="ClassPathXmlApplicationContext">
    <constructor-arg index=0><value>myAppContext.xml</value></constructor-arg>
    <constructor-arg index=1><ref this/></constructor-arg>
    </bean>

    ...where <ref this/> (or something similar) would set an argument/property with type
    ApplicationContext, and the value is the ApplicationContext holding the defined bean.

    It this possible? And when will I see a 1.1.2 release with this implemented? 8)

    -Thomas

    PS! Generally I would like to see all org.springframework public code implemented to
    be used in the spring framework (conforming to JavaBeans conventions)!

  2. #2
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    For what purpose would you need such a feature?

    Maybe ContextSingletonBeanFactoryLocator might be useful for what you plan to do. For more information see also the Reference manual chapter 3.16.

    Regards,
    Andreas

  3. #3
    Join Date
    Oct 2004
    Posts
    4

    Default

    I'm writing an application containing a lot of spring enabled beans. The application can
    operate in several contexts. Some state is shared between these contexts and some is not.
    I have implemented this with an ApplicationContext hierarchy, where the shared state is
    set up as singleton beans in a shared parent ApplicationContext, and the context specific
    state is set up as singleton and prototype beans in a context specific child
    ApplicationContext. This way the ApplicationContext objects directly correspond with my
    application's contexts (then i probably have done something right, huh?).

    On the other hand, I have now redesigned my code a little such that the entire
    ApplicationContext hierarchy is created in code, so I actually don't need the feature
    anylonger. 8) Thanks for the quick reply anyways!!!

Similar Threads

  1. Replies: 12
    Last Post: Oct 30th, 2010, 12:26 AM
  2. Replies: 1
    Last Post: Jul 28th, 2005, 05:08 PM
  3. avoiding duplication when using list element
    By markjvickers in forum Container
    Replies: 6
    Last Post: Jun 20th, 2005, 07:49 AM
  4. Replies: 3
    Last Post: Sep 7th, 2004, 12:30 AM
  5. Replies: 3
    Last Post: Aug 30th, 2004, 09:56 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
  •