paint-brush
Difference Between Spring MVC and Spring Bootby@sandeep-pandey
296 reads

Difference Between Spring MVC and Spring Boot

by Sandeep PandeyJune 18th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

DispatcherServlet is the servlet that controls the flow of a request from view to controller. Since Spring 3.1, the Servlet 3 API is supported and we no longer need web.xml for configuring. Spring Boot requires no configuration; it is used to create production-ready applications with zero XML configuration in your project. It wraps all dependencies under spring-boot-started-web, comes with an embedded server, and can be packaged as a jar. It is well-suited for container based development and deployment of microservices.

Coin Mentioned

Mention Thumbnail
featured image - Difference Between Spring MVC and Spring Boot
Sandeep Pandey HackerNoon profile picture

Spring MVC is a framework that is used to build web applications. It follows the Model View Controller patternDispatcherServlet is the servlet that controls the flow of a request from view to controller. Since Spring 3.1, the Servlet 3 API is supported and we no longer need web.xml for configuring DispatcherServlet – instead, it is configured programmatically.

We implement a class with the WebApplicationInitializer interface and add the onStartup() method to add DispatcherServlet to ServletContext.

The @Controller annotation on class name declares this class as a Spring bean, and the @RequestMapping annotation declares that this class is the default handler for all requests of type ‘/’.

Spring Boot requires no configuration; it is used to create production-ready applications with zero XML configuration in your project. We don’t need a deployment descriptor, web server, etc.

It wraps all dependencies under spring-boot-started-web, comes with an embedded server, and can be packaged as a jar. 

@SpringBootApplication is the @Configuration, @EnableAutoConfiguration, and @ComponentScan annotations combined and configured with their default attributes.

Spring boot, which is built on Spring, is easy to learn and comes with built-in features that reduce the learning curve. It is well-suited for container based development and deployment of microservices.