Hackernoon logoDifference Between Spring MVC and Spring Boot by@sandeep-pandey

Difference Between Spring MVC and Spring Boot

Author profile picture

@sandeep-pandeySandeep Pandey

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.

Tags

The Noonification banner

Subscribe to get your daily round-up of top tech stories!