Refactoring of the service factory through reflection.