Announcement Announcement Module
Collapse
No announcement yet.
The ref element Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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!!!

      Comment

      Working...
      X