Spring Boot 注释

Posted HkGov

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Spring Boot 注释相关的知识,希望对你有一定的参考价值。

1.
@RestController
@RestController ≈ @Controller + @ResponseBody
在Controller文件 public class xxxx 前面加
用于返回
2.
@RequestMapping(value =  "/hello",method = RequestMethod.GET)
@RequestMapping  用于设置访问的方法  使用GET还是POST等

3.
返回直接用return

4.
@Value("${cupSize}")
private String cupSize;

@Value调用配置文件
配置文件可以不用写数据类型,在调用出来后用private设置数据类型为String或者Int














以上是关于Spring Boot 注释的主要内容,如果未能解决你的问题,请参考以下文章