Fixing stub; fixing key mask which was overly restrictive (last attempt ...

...caused tests to fail). Sorting Spring contexts so there are no duplicate objects in the two contexts.