In the above configurationdispatcher-servlet.xml file, we have defined a tag.<context:component-scan> This will allow Spring to load all the components from the package org.codestrs.controller and all its child packages.

This loads.BaseAnnotated.class Also, we have defined a bean viewResolver. This bean will resolve the view and add prefix string,/WEB-INF/views/ and suffix .jsp to the view in ModelAndView. Note that in our BaseAnnotatedclass, we have return a ModelAndView object with view name welcome. This will be resolved to path /WEB-INF/jsp/index.jsp .

2.4 Create Controller

Java

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

packageorg.codestrs.controller;

importorg.springframework.stereotype.Controller;

importorg.springframework.web.bind.annotation.RequestMapping;

importorg.springframework.web.servlet.ModelAndView;

@Controller

publicclassBaseAnnotated{

@RequestMapping("/")

publicModelAndView getmainPage(){

ModelAndView mv=newModelAndView("index");

mv.addObject("msg","Annotated Controller");

returnmv;

}

}

That’s All , You have Configured your basic Spring Boot Application . Watch Video for more eclipse settings if you have any queries.