首页 > 编程语言 > 详细

SpringBoot鸡汤(注解集合二)

时间:2017-12-22 16:31:13      阅读:251      评论:0      收藏:0      [点我收藏+]

1.@NotNull :属性值不为空
2.@Profiles

@Configuration  
@Profile("production")  
public class ProductionConfiguration {  
// ...  
}  

 3.@PathVariable是用来获得请求url中的动态参数的
例子:

@RestController
@RequestMapping(value=”/users”)
public class MyRestController {
    @RequestMapping(value=”/{user}”, method=RequestMethod.GET)
    public User getUser(@PathVariable Long user) {
    // …
    }
    @RequestMapping(value=”/{user}/customers”, method=RequestMethod.GET)
    List getUserCustomers(@PathVariable Long user) {
    // …
    }
    @RequestMapping(value=”/{user}”, method=RequestMethod.DELETE)
    public User deleteUser(@PathVariable Long user) {
    // …
    }
}

 

SpringBoot鸡汤(注解集合二)

原文:http://www.cnblogs.com/MaxElephant/p/8086511.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!