Results 1 to 3 of 3

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

  1. #1
    Join Date
    Oct 2010
    Posts
    2

    Question 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    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...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Oct 2010
    Posts
    2

    Thumbs up

    Quote 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

Tags for this Thread

Posting Permissions

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