Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does spring internally uses servlets? [duplicate]

I have a doubt whether the servlets internally uses servlets or not?

like image 791
BalajiB Avatar asked Feb 16 '17 10:02

BalajiB


People also ask

Are servlets used in spring boot?

In a Spring Boot application, the servlet is registered either as a Spring @Bean or by scanning the @WebServlet annotated classes with an embedded container. With the Spring @Bean approach, we can use the ServletRegistrationBean class to register the servlet.

What servlet container does Spring use?

The Spring Boot starters ( spring-boot-starter-web in particular) use Tomcat as an embedded container by default.

Are Spring controllers servlets?

Spring MVC is one of many frameworks built on top of servlets to try make the task of writing a web application a bit easier. Basically all requests are mapped to the DispatcherServlet which acts as a front controller. The DispatcherServlet will then call the controller whose annotations match the incoming request.


1 Answers

Yes it is. Spring-MVC uses DispatcherServlet under the hood.

Central dispatcher for HTTP request handlers/controllers, e.g. for web UI controllers or HTTP-based remote service exporters. Dispatches to registered handlers for processing a web request, providing convenient mapping and exception handling facilities.

This servlet is very flexible: It can be used with just about any workflow, with the installation of the appropriate adapter classes...

like image 156
Suresh Atta Avatar answered Sep 21 '22 08:09

Suresh Atta