Springboot基础篇 Controller
来源:互联网 发布:如何禁止mac电脑上网 编辑:程序博客网 时间:2024/06/06 03:46
如果用过Springmvc那么对controller就不会太陌生:
@RestController 控制器的注解;
拓展一下注解篇:
@Autowired 自动注入得配置(相当于springmvc中的 @resource注解)
@GetMapping 提交的方式;例如:
查询 :@GetMapping
增加 :@PostMappin
删除 :@DeleteMapping
更新 :@PutMapping
@Autowired private GirlRespository girlRespository; @Autowired private GirlService girlService; @GetMapping(value = "/girls") public List<Girl> girlList(){ return girlRespository.findAll(); }
3.获取参数的注解:(从实例中获取)
@PathVariable(“id”) Integer id:
例如 http:localhost:8080/girl?id=?
@RequestParam(“age”) Integer newage,:从url中获取参数
实例:
@PutMapping(value = "/update/{id}") public Girl updateGirl(@PathVariable("id") Integer id, @RequestParam("age") Integer newage, @RequestParam("cupsize") String newSize) {
阅读全文
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层测试
- SpringBoot基础
- springboot基础
- 【SpringBoot】SpringBoot基础-HelloWord实例
- Springboot基础篇 (一)启动方式
- Junit4 + MockMvc 进行单元测试,springboot controller单元测试
- SpringBoot入门(三)Controller的使用
- 腾讯地图标注公司
- Mac 下实现 pyenv/virtualenv 与 Anaconda 的兼容
- MySQL数据库中插入,更新与删除数据
- org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement错误
- 软件测试
- Springboot基础篇 Controller
- GSON案例[L]
- php.ini 配置调优 —— 让 PHP 应用性能维持在更高水平
- 欢迎使用CSDN-markdown编辑器
- Python3.6 爬虫初体验--urllib、beautifulsoup(一)
- SVN版本冲突解决详解
- 用Promise优化nodejs的callback hell
- js调用exe文件 兼容所有浏览器
- 排序