springboot注解

xiaoxiao2021-03-01  13

@Value("${}") #配置文件中的属性值注入 @Component #把普通pojo实例化到spring容器中 @ConfigurationProperties #可以把同类的配置信息自动封装成实体类 @Controller #处理http请求 @RestController #spring4之后新加的注解,原来返回json需要@ResponseBody配合@Controller @RequestMapping #配置url映射 @PathVariable #获取url中的数据 @RequestParam #获取请求参数的值 @GetMapping #组合注解,以get方式配置url,相当于@RequestMapping(value="/demo",method=RequestMethod.GET) @PostMapping #组合注解,以post方式配置url,相当于@RequestMapping(value="/demo",method=RequestMethod.POST) @Entity #实体类属性注入数据库表 @Id @GeneratedValue private Integer id; #实体类id字段注入数据库表,并且id自增 @Autowired #对类成员变量、方法及构造函数进行标注,完成自动装配的工作 @Transactional #事务注解,事务简单理解就是让一个连续的操作(一般是数据库操作)要么同时成功,要么同时失败
转载请注明原文地址: https://www.6miu.com/read-3350273.html

最新回复(0)