Announcement Announcement Module
No announcement yet.
How to reference a SingletonContext instance from a WebApplicationContext Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to reference a SingletonContext instance from a WebApplicationContext

    We are building a complex J2EE application with multiple layers, each layer having its own IoC container definition. Beside, we have multiple sibling web application which use beans from others layers. Everything is packaged in an EAR file.

    I've used the ContextSingletonBeanFactory ContextSingletonBeanFactoryLocator example to define a context hierarchy and to resolve beans from the lower layers and avoid duplication among the various WEB modules. http://

    It works perfectly except for one of my web module.
    This module is referencing bean from the lower layer directly in the context-file, (the others are using the SingletonContextFactoryLocator programmatically)

    HTML Code:
    <bean class="org.springframework.remoting.rmi.RmiServiceExporter">
    		<property name="service">
    			<ref parent="autocompleterServiceDelegate"/>
    		<property name="serviceName" value="rmiAutocompleterService"/>
    		<property name="serviceInterface" value="com.sgam.tanis.svc.client.delegate.IAutocompleterDelegate"/>
    		<property name="registryPort" value="${rmiPort}"/>
    My question is how to reference a bean loaded in the EAR classloader from a WebApplicationContext.
    The reference documumentation states you should use the SingletonContext instances
    as the parents of the web-application Spring IoC container instances
    But I could not figured out how to do this.

    Can please someone help me, I'm stuck here.


  • #2

    Ok after some more search in the forum, i've found the solution to my problem in this thread
    which was directing to Joris Kuipers excellent article on Singleton IoC containers.

    The parentContextKey does the trick

    HTML Code:
    Sorry I have polluted this forum.