What is the difference between @PathParam and @PathVariable

后端 未结 7 1600
天涯浪人
天涯浪人 2020-12-23 19:21

To my knowledge both serves the same purpose. Except the fact that @PathVariable is from Spring MVC and @PathParam is from JAX-RS. Any insights on

7条回答
  •  攒了一身酷
    2020-12-23 20:04

    @PathParam is a parameter annotation which allows you to map variable URI path fragments into your method call.

    @PathVariable is to obtain some placeholder from the URI (Spring call it an URI Template)

提交回复
热议问题