Refactor for spring