Overriding Spring Beans with Aliases
![Image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh13w8HAihAnAQpDttNdBt41zZJCZhM45NPW7Izd8uNutnGJt_2uL6E2dWMVU4DVL76ibrewhwJFgFc8q5jbIjS3goz9K5Nd4wrgMFzmbDX7p3ghXQF-l17FIUwo2G1D9vrBBrhsXDkLXs/s1600/springlogo.png)
The most common approach followed for overriding a spring bean is to define a new bean, with the same id as the original bean, in a separate XML file. During context initialization, Spring would register the last bean found for the id, and use it for all the injections. I dislike this approach for two reasons.