Guice and Spring represent fundamentally different dependency injection paradigms.
In Spring:
- There is an application context that holds instantiated objects that may be injected into their collaborators.
- The default scope is singleton, but the context may hold proxies or factories for some objects that require different scopes.
- If an object in the context requires an instance of a type to be injected that does not exist in the context, an exception will be thrown.
- There is an injector that can create instances of any type requested.
- The default scope is to create a new instance for every injection.
- If an object requires an instance of any type, it will be instantiated by default.
No comments:
Post a comment