spring migration and code refactoring