MFPC-372 : Fix memory leak on spring registry. The factory bean feed a

alreadyCreated Set but never clean it. And mule ensure unique name by
getting bean on factory. So we create à large number of false already
created bean in Spring.
quite a lot of code repeated. Should it be extracted into a parametrised method?