JAVA framework SpringMVC RequestMapping explanation

1. Narrow the request mapping

Do RequestMapping annotation on the class.

Benefits: Avoid duplication of urls with other people in the same project, resulting in request confusion, and easy management.

1 @Controller
2 @RequestMapping(value = "/goods")
3 public class goodsController {
4     @Resource(name="goodsServiceImpl")
5     private goodsService goodsService;

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325180958&siteId=291194637