October 2017
Intermediate to advanced
396 pages
10h 2m
English
The Spring MVC allows you to use the @RequestMapping annotation at the class level. This means we can annotate the controller class with @RequestMapping, as shown in the following code snippet:
package com.packt.patterninspring.chapter10.bankapp.web.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping("/")
public class HomeController {
@RequestMapping(method=GET)
public String home() {
return "home";
}
}
As you have seen in the preceding code, the HomeController class is annotated with the @RequestMapping ...
Read now
Unlock full access