Update 11.3.1. The @RestController and @RequestMapping annotations.md

master
qibaoguang 2015-05-15 10:18:34 +08:00
parent d2449a580a
commit a4bd06a61f
1 changed files with 1 additions and 1 deletions

View File

@ -1,7 +1,7 @@
### 11.3.1. @RestController和@RequestMapping注解
我们的`Example`类上使用的第一个注解是`@RestController`。这被称为一个构造型stereotype注解。它为阅读代码的人们提供建议。对于Spring该类扮演了一个特殊角色。在本示例中我们的类是一个web `@Controller`所以当处理进来的web请求时Spring会询问它。
我们的Example类上使用的第一个注解是`@RestController`。这被称为一个构造型stereotype注解。它为阅读代码的人们提供建议。对于Spring该类扮演了一个特殊角色。在本示例中我们的类是一个web `@Controller`所以当处理进来的web请求时Spring会询问它。
`@RequestMapping`注解提供路由信息。它告诉Spring任何来自"/"路径的HTTP请求都应该被映射到`home`方法。`@RestController`注解告诉Spring以字符串的形式渲染结果并直接返回给调用者。