Added test for Spring scopes, refactoring