SpringBoot Controller
来源:互联网 发布:js断点调试 编辑:程序博客网 时间:2024/06/03 18:09
@Controller处理HTTP请求
@RestController = @Controller + @ResponseBody 处理Rest请求
@RequestMapping 配置URL映射
1、获取请求参数的两种方式
@RestControllerpublic class HelloController { @Value("${cupSize}") private String cupSize; @Value("${age}") private Integer age; @Autowired private GirlProperties girlProperties; //请求形式1 // localhost:8082/hello/12 @RequestMapping(value = "/hello/{id}",method = RequestMethod.GET) public String say(@PathVariable("id") Integer id) { return "id:" + id; } //请求形式2 //localhost:8082/hello?hi=12 //@RequestMapping(value = "/hi",method = RequestMethod.GET) @GetMapping(value = {"/hi","hello"}) public String hi(@RequestParam(value = "id",required = false,defaultValue = "0") Integer id) { return "id:" + id; }}
required = false,defaultValue = "0"表示不必须,缺省值为0
阅读全文
0 0
- springboot controller
- springboot-Controller
- SpringBoot Controller
- springBoot Controller的使用
- Springboot基础篇 Controller
- springboot-controller的使用
- 解决springBoot无法访问controller
- SpringBoot扫描到Controller
- SpringBoot Controller找不到视图路径
- SpringBoot之Controller(B)
- SpringBoot Controller找不到视图路径
- springBoot+mockMvc Controller层测试
- Junit4 + MockMvc 进行单元测试,springboot controller单元测试
- SpringBoot入门(三)Controller的使用
- SpringBoot+MockMvc测试Controller笔记整理
- springboot项目访问不到controller方法。
- SpringBoot配置非含main类的Controller的注解
- SpringBoot 中常用注解@Controller/@RestController/@RequestMapping介绍
- 大数据之数据采集
- Android Bitmap理解
- POI设置EXCEL单元格格式为文本、小数、百分比、货币、日期、科学计数法和中文大写
- seinfo命令详解
- 第一个Python程序
- SpringBoot Controller
- poi公式处理
- sql优化
- SpringBoot应用MyBatis
- 10月16日 树状数组(敌兵布阵)
- 面向对象程序设计上机练习五(类和对象)
- JZOJ4883. 【NOIP2016提高A组集训第12场11.10】灵知的太阳信仰 2017.10(B组)
- JSEL
- C++信息学奥赛一本通1049