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) {
    // …
    }
}

 

posted on 2017-12-22 16:17  巨象  阅读(234)  评论(0编辑  收藏  举报