Best way to override beans in Spring
<p>I have an application that consists of 2 modules.</p>

<p>First of them is main one and it can work without second module installed.</p>

<p>I have beans with default implementation defined in <code>beans.xml</code> file of main module. And when installing second module I want to keep the ids of those beans but change the implementation to use new classes. </p>

<p>What is the best way to do that?</p>

<p><code>beans.xml</code> of first module:</p>

<pre><code>...
&lt;bean id="myCoolService" class="com.blabla.defaultCoolServiceImpl"&gt;
...
</code></pre>

<p>and after the installation of second module I want to use the implementation of <code>myCoolService</code> that is defined in second module.</p>

<p><strong>Upd:</strong>
Spring version is 3.2.4.
I need to make as little changes as possible so I need to continue using xml-driven configuration.</p>