Refactoring spring configurations