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

 

相关文章:

  • 2022-03-01
  • 2021-06-26
  • 2021-06-03
  • 2022-02-06
  • 2021-10-10
  • 2022-12-23
  • 2022-02-15
  • 2021-08-13
猜你喜欢
  • 2021-12-22
  • 2021-05-17
  • 2022-12-23
  • 2021-09-08
相关资源
相似解决方案