Similar to the previous example, let's create a simple Controller. Consider the example of a controller here:
@Controller public class BasicViewController { @RequestMapping(value = "/welcome-view") public String welcome() { return "welcome"; } }
A few important things to note are as follows:
- @RequestMapping(value = "/welcome-view"): We are mapping an URL /welcome-view.
- public String welcome(): There is no @RequestBody annotation on this method. So, Spring MVC tries to match the string that is returned, welcome, to a view.