Container
Servlet container of Tomcat creates servlet objects which are required to run the application.
You configure all the servlets in web.xml and provide classes.
Tomcat reads XML and creates servlet objects.
Spring container
Similarly, Spring provides container of beans. This container handles :
- Instantiation of objects
- Life cycle of objects
- Destruction of objects
When you create object using new keyword, Spring doesn't know it and will not manage it.
Bean Factory
Spring reads configuration / annotations and uses Factory pattern to create objects.
XML --> Bean factory --> objects
No comments:
Post a Comment
Note: only a member of this blog may post a comment.