Announcement Announcement Module
Collapse
No announcement yet.
Issue with Singleton when using multiple Context in a single beanfactory. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issue with Singleton when using multiple Context in a single beanfactory.

    Hi,


    ================================================== =======

    <beans>
    <import resource="classpath*:solution-beanfactory-registry.xml"/>
    <bean id="core-diag-test-config"
    class="org.springframework.context.support.ClassPa thXmlApplicationContext"
    lazy-init="true">
    <constructor-arg>
    <value>core-diag-test-config.xml</value>
    </constructor-arg>
    </bean>
    <bean id="core-mnipclient-outbound"
    class="org.springframework.context.support.ClassPa thXmlApplicationContext"
    lazy-init="true">
    <constructor-arg>
    <value>core-mnipclient-outbound.xml</value>
    </constructor-arg>
    </bean>
    <bean id="core-diag-test-cpm-ruleman-config"
    class="org.springframework.context.support.ClassPa thXmlApplicationContext"
    lazy-init="true">
    <constructor-arg>
    <value>core-diag-test-cpm-ruleman-config.xml</value>
    </constructor-arg>
    </bean>
    </beans>


    Solution-beanfactory-registry.xml : contians the bean factory like the above.

    There is a commmon beans among all these , but still we they are not singleton in nature. is there anyway i can redefine the above beanfactory configurations.


    ================================================== =======



    Regards
    Ramchandhar Reddy Rapolu

  • #2
    Use [ code][/code ] tags when posting code ..

    The Singleton is a singleton per BeanFactory not per classloader (as you would get with the singleton pattern). If you really want a singleton, load it in a ApplicationContext and use that as a parent...

    Comment


    • #3
      Originally posted by Marten Deinum View Post
      Use [ code][/code ] tags when posting code ..

      The Singleton is a singleton per BeanFactory not per classloader (as you would get with the singleton pattern). If you really want a singleton, load it in a ApplicationContext and use that as a parent...

      Some confusion:

      WHen you say....Classloader are you refering to ClasspathXmlContext. and what is an applcation context.

      Can you provide a sample for abve code , how to use applicationContext.

      Regards
      Ram

      Comment

      Working...
      X