Blog Detail

  • Home
  • Enable MVC in Spring Boot

Enable MVC in Spring Boot

In this post I have posted the steps for to enable the Spring MVC flow in Spring Boot Application. In normal spring application if we want to add the MVC, we should prepare the xml for define the dispatcher servlet its hard to and need to spend some time on it. but in spring boot make it every configuration as easy. because its doing autoconfiguration based on dependency that we are added in pom file. so here no need to add dispatcher servlet.

In your spring boot application if you want to enable the MVC you just follow below steps. that’s really helps you to enable MVC in your spring boot application quickly.




Java Controller

package com.samplecoder.emo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

public class ApplicationController {

	public String index() {
		return "index";


This index.jsp file should be presented inside the src/main/webapp/WEB-INF/view folder

<!DOCTYPE html>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
<h1>Hello!. This is my spring boot MVC application</h1>


After done this changes in your code, you just run the application and check the result here! http://localhost:8080/index

1 Comment

Write a comment