SpringBoot鸡汤(注解集合二)

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) {
    // …
    }
}
原文地址:https://www.cnblogs.com/MaxElephant/p/8086511.html