Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the difference between servlet container and spring container? [closed]

What are the roles and responsibility of servlet container and spring container? Please someone clarify my doubts.

like image 375
Balasubramani Avatar asked Jan 20 '15 08:01

Balasubramani


People also ask

What is the difference between servlet and Spring?

Servlet: a server side java class to produce the html content. Spring: A framework to develop Big Enterprise Application which include your servlet as well.

What is servlet container in Spring?

A Servlet Container or Web Container (like Tomcat) is an implementation of various Java EE specifications like Java Servlet, JSP, etc. Put in a simple way, it is an environment where Java web applications can live. A web server + Java support.

What is difference between servlet and servlet container?

In Layman terms : A web Server means: Handling HTTP requests (usually from browsers). A Servlet Container (e.g. Tomcat) means: It can handle servlets & JSP. An Application Server (e.g. GlassFish) means: *It can manage Java EE applications (usually both servlet/JSP and EJBs).

What is the difference between Spring container and IoC Container?

An IoC container is a common characteristic of frameworks that implement IoC. In the Spring framework, the interface ApplicationContext represents the IoC container. The Spring container is responsible for instantiating, configuring and assembling objects known as beans, as well as managing their life cycles.


1 Answers

They are very different concepts also if their names are similar.

A Servlet Container or Web Container (like Tomcat) is an implementation of various Java EE specifications like Java Servlet, JSP, etc. Put in a simple way, it is an environment where Java web applications can live. A web server + Java support.

A Spring Container on the other hand, is the core and the engine of the Spring Framework. It is an IoC Container that handles Spring applications lifecycle creating new beans and injecting dependencies.

Because a Spring application can be a web application, a Spring Container can "live" inside a Web Container.

For further information:

  • about Servlet Container: http://en.wikipedia.org/wiki/Web_container

  • about Spring Container: http://docs.spring.io/spring/docs/current/spring-framework-reference/html/beans.html

like image 69
davioooh Avatar answered Sep 19 '22 16:09

davioooh