Spring IoC container gives you an option of replacing a method of a bean. Can someone provide a real life example of using this feature to solve real life problem?
I can see this used for adapting an old legacy code (w/o sources) to work with your app. But I think I would consider writing an adapter class using the legacy code directly instead of Spring method replacement approach.
As the documentation says, it’s not ‘commonly useful’ functionality.
A case where it may be useful though is to alter the functionality of a third party method (you don’t necessarily have the source) of a final class – i.e. one whose functionality can’t be modified or extended through inheritance.
I guess it would still amount to something of a hack though 🙂