Announcement Announcement Module
No announcement yet.
Bean Overriding in spring Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bean Overriding in spring

    As spring claims that by default it create singleton beans so lets say I have a bean in my first xml(first.xml) file

    <bean id="abstractSuper" class="com.test.Parent" />

    now in another file(second.xml) I have another bean

    <bean id="abstractSuper" class="com.test.Child" />

    So in my final applicationContext file I import both these two files and spring creates a single bean and actually the declaration which comes second overrides first bean declaration which is fair spring claims beans overriding.....

    but my question is when I do it for

    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">

    This concept does not work....actually I am using a jar file in which I have a applicationContext file in which this declaration is there.....but to use that jar file I have to import its applicationContect.xml file in my applicationContext.xml .....and my applicationContext also has C3p0 bean declaration ....but when I enable jmx then I see that I end up with two c3p0 beans....

    can you pls let me know ....what I am missing..? or spring has some other behaviour for this..?