spring boot 中@RestController 注解
来源:互联网 发布:veket linux最新版本 编辑:程序博客网 时间:2024/06/02 01:12
spring boot 可以认为是spring mvc 的升级版。
在spring mvc 中,用的是@Controller注解
@RestController注解相当于 @Controller与@ResponseBody这两个注解的作用。
现在的web开发,大多数都是前后端分离的。所以用@RestController注解会更多。基本上不会用到ModelAndView了。
===========获取参数值================
@PathVariable(“”):获取url中restful风格的参数,适合于获取get请求的参数
@RequestMapping(value = "/say/{name}/{age}", method = RequestMethod.GET) public String say(@PathVariable("name")String name,@PathVariable("age") int age){ return "hello " +name +" "+age; }
@RequestParam(“”):获取传统请求中的参数(post或者get都可以),比如 http://localhost:8888/xxx/say123?name=zhangsan&age=19
@RequestMapping(value = "/say123", method = RequestMethod.GET) public String say123(@RequestParam("name")String name,@RequestParam("age") int age){ return "hello " +name +" "+age; }
阅读全文
0 0
- spring boot 中@RestController 注解
- (13)spring boot中常用的注解@RestController和@RequestMapping
- spring boot注解@SpringBootApplication、@Controller、@RestController
- Spring注解之:@RestController
- Spring Boot中@Controller和@restController的区别
- Spring注解@RestController与@Controller的区别
- Spring 中 @Controller 和 @RestController
- Spring Boot中几个常用的注解
- 在Spring Boot中使用 @ConfigurationProperties 注解
- (14)spring boot中@SpringBootApplication注解
- Spring boot 中常用的注解
- spring boot中使用@Value注解
- spring boot 处理请求的方式 Controller 与RestController
- 《spring-boot学习》-12-@controller和@RestController的区别?
- Spring中@Controller和@RestController的区别?
- spring MVC中, @controller 和 @restController
- Spring中@Controller和@RestController的区别
- Spring Boot的被@SpringBootApplication注解的App.java必须放在所有的RestController的根路径的package下
- codeforces 437 c 贪心+图论
- 在VMware Workstation上安装CentOS6.5(字符界面)教程
- 关于队列的相关操作(初始化,判断队满队空,以及入队出队)
- keil 5 for mdk 不支持lpc2138的解决办法
- 学习网站
- spring boot 中@RestController 注解
- angularjs的uigrid中celltemplate如何显示scope里的内容
- Wireshark学习及三次握手
- 2017计蒜之道第一场题解
- 软件版本GA,RC,alpha,beta,Build 含义
- 第十二天 写写感悟吧,重新看疯狂java讲义
- browserify的介绍
- Android开发之TabLayout的使用(实现三种常用的选项卡效果)
- Kotlin操作符