![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
spring
spring
陈暗暗
天道酬勤
展开
-
@PathVariable注解
功能:接收请求路径中占位符的值用法:/** *占位符映射 * @param username * @param realname * @return */@RequestMapping("hello/{username}/{realname}")public String hello(@PathVariable("username") String username ,@P...原创 2020-04-20 15:26:54 · 3339 阅读 · 0 评论 -
@Validated注解
在springboot中,@Validated可对后台接收model进行数据校验,不符合则抛出异常。使用场景:1、在model中进行声明规则@Datapublic class UserVo { @NotBlank(message = "用户名不能为空") private String username; @Size(min = 5 ,max = 20) ...原创 2020-04-20 14:41:03 · 4238 阅读 · 0 评论