i am prepping for
scjp 6 and overriding and overloading classes has gotten me nuts so overriding beans is a welcome change
lets see, You have a class where you try to make a web service call or post a msg on JMS, now you define a bean called "remoteCall" in mainAppContext.xml. (this is production code, it will work fine on any E2E environment) the class definbed as bean "remoteCall" lets say WSAndJMSClient.java knows everything about RPC.
now comes the overriding, You want to integration
test your application without connecting to the actual WS or JMS, so you define a bean by the name of "remoteCall" in testAppContext.xml with the class as TestProxyClient.java (now this class does not have any of the RPC stuff and simply returns a success response...).
when the context is loaded in integration test mode load mainAppContext.xml first >> then >> testAppContext.xml and you can test your application without WS or JMS, For production dont add the test*.* files in the jar\war\ear and you have actual connectivity without changing a single line of code...