{"id":6431,"date":"2026-06-09T14:57:45","date_gmt":"2026-06-09T05:57:45","guid":{"rendered":"https:\/\/route-zero.com\/recruit\/?post_type=route&#038;p=6431"},"modified":"2026-10-09T14:58:19","modified_gmt":"2026-10-09T05:58:19","slug":"spring-boot-requestparam-pathvariable-url","status":"publish","type":"route","link":"https:\/\/route-zero.com\/recruit\/route\/6431\/","title":{"rendered":"Spring Boot\u306e@RequestParam\u3068@PathVariable\u306e\u9055\u3044\uff5cURL\u3067\u5224\u65ad"},"content":{"rendered":"<p>Spring Boot\u306e`@RequestParam`\u3068`@PathVariable`\u306f\u3001\u3069\u3061\u3089\u3082URL\u307e\u308f\u308a\u306e\u5024\u3092Controller\u3067\u53d7\u3051\u53d6\u308b\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u3059\u304c\u3001\u5024\u3092\u53d6\u308a\u51fa\u3059\u5834\u6240\u304c\u9055\u3044\u307e\u3059\u3002`\/products\/42`\u306e\u3088\u3046\u306a\u30d1\u30b9\u5185\u306eID\u306f`@PathVariable`\u3001`\/products?category=book&amp;page=2`\u306e\u3088\u3046\u306a\u691c\u7d22\u6761\u4ef6\u306f`@RequestParam`\u304c\u57fa\u672c\u3067\u3059\u3002URL\u8a2d\u8a08\u3067\u8ff7\u3063\u305f\u3089\u300c\u5bfe\u8c61\u3092\u7279\u5b9a\u3059\u308b\u5024\u304b\u3001\u4e00\u89a7\u3092\u7d5e\u308a\u8fbc\u3080\u6761\u4ef6\u304b\u300d\u3092\u5148\u306b\u8003\u3048\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>\u6700\u521d\u306b\u6bd4\u8f03\uff1a\u540c\u3058URL\u3067\u3082\u53d7\u3051\u53d6\u308b\u5834\u6240\u304c\u9055\u3046<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u89b3\u70b9<\/th>\n<th>@PathVariable<\/th>\n<th>@RequestParam<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u53d7\u3051\u53d6\u308b\u5834\u6240<\/td>\n<td>URL\u30d1\u30b9\u306e`{id}`\u306a\u3069\u306e\u5909\u6570<\/td>\n<td>\u30af\u30a8\u30ea\u6587\u5b57\u5217\uff08Spring MVC\u3067\u306f\u30d5\u30a9\u30fc\u30e0\u30d1\u30e9\u30e1\u30fc\u30bf\u3082\u5bfe\u8c61\uff09<\/td>\n<\/tr>\n<tr>\n<td>\u4ee3\u8868URL<\/td>\n<td>`GET \/products\/42`<\/td>\n<td>`GET \/products?category=book`<\/td>\n<\/tr>\n<tr>\n<td>\u3088\u304f\u3042\u308b\u7528\u9014<\/td>\n<td>\u8a73\u7d30\u5bfe\u8c61\u306eID\u3001\u89aa\u5b50\u30ea\u30bd\u30fc\u30b9\u306e\u8b58\u5225\u5b50<\/td>\n<td>\u691c\u7d22\u3001\u4e26\u3073\u66ff\u3048\u3001\u30da\u30fc\u30b8\u756a\u53f7\u3001\u7d5e\u308a\u8fbc\u307f<\/td>\n<\/tr>\n<tr>\n<td>Controller\u5074\u306e\u4f8b<\/td>\n<td>`@PathVariable(&quot;id&quot;) Long id`<\/td>\n<td>`@RequestParam(&quot;category&quot;) String category`<\/td>\n<\/tr>\n<tr>\n<td>\u7701\u7565\u53ef\u80fd\u306a\u5024<\/td>\n<td>URL\u30d1\u30bf\u30fc\u30f3\u81ea\u4f53\u3068\u306e\u4e00\u81f4\u3082\u8003\u616e\u3059\u308b<\/td>\n<td>`required=false`\u3084`defaultValue`\u3067\u6271\u3048\u308b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3069\u3061\u3089\u304c\u6280\u8853\u7684\u306b\u512a\u79c0\u3068\u3044\u3046\u8a71\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002API\u306eURL\u304b\u3089\u4f55\u304c\u30ea\u30bd\u30fc\u30b9\u3092\u6307\u3057\u3001\u4f55\u304c\u691c\u7d22\u6761\u4ef6\u306a\u306e\u304b\u304c\u8aad\u307f\u53d6\u308c\u308b\u5f62\u306b\u3059\u308b\u306e\u304c\u76ee\u7684\u3067\u3059\u3002\u3053\u308c\u3089\u306fSpring MVC\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u3042\u308a\u3001\u3053\u3053\u3067\u306fServlet\u30d9\u30fc\u30b9\u306eSpring Boot Web MVC\u3092\u5bfe\u8c61\u3068\u3057\u307e\u3059\u3002<\/p>\n<hr>\n<h2>@PathVariable\uff1aURL\u30d1\u30b9\u306eID\u3092\u53d7\u3051\u53d6\u308b<\/h2>\n<p>\u5546\u54c1\u8a73\u7d30\u3092`\/products\/42`\u3067\u8868\u793a\u3059\u308b\u5834\u5408\u3001`42`\u306f\u30d1\u30b9\u306e\u4e00\u90e8\u5206\u3067\u3059\u3002`@GetMapping(&quot;\/{id}&quot;)`\u3068`@PathVariable`\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3068\u3001\u305d\u306e\u90e8\u5206\u3092\u5f15\u6570\u306b\u53d7\u3051\u53d6\u308c\u307e\u3059\u3002<\/p>\n<pre><code>@RestController\r\n@RequestMapping(&quot;\/products&quot;)\r\nclass ProductController {\r\n    private final ProductService products;\r\n\r\n    ProductController(ProductService products) {\r\n        this.products = products;\r\n    }\r\n\r\n    @GetMapping(&quot;\/{id}&quot;)\r\n    ProductDto findOne(@PathVariable(&quot;id&quot;) Long id) {\r\n        return products.findById(id);\r\n    }\r\n}<\/code><\/pre>\n<p>`GET \/products\/42`\u306a\u3089`id`\u3078\u6570\u502442\u304c\u6e21\u308a\u307e\u3059\u3002\u4e0a\u8a18\u306e`ProductService`\u3068`ProductDto`\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5074\u3067\u5225\u9014\u5b9a\u7fa9\u3059\u308b\u578b\u3067\u3059\u3002\u3053\u306e\u4f8b\u3067\u306f\u30e1\u30bd\u30c3\u30c9\u3092\u77ed\u304f\u3057\u3066\u3001\u53d7\u3051\u53d6\u308a\u65b9\u306b\u7d5e\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30d1\u30b9\u306b\u5fc5\u8981\u306a\u90e8\u5206\u304c\u5b58\u5728\u3057\u306a\u3051\u308c\u3070\u3001\u307e\u305aURL\u304c\u30de\u30c3\u30d4\u30f3\u30b0\u306b\u4e00\u81f4\u3059\u308b\u304b\u3069\u3046\u304b\u306e\u554f\u984c\u306b\u306a\u308a\u307e\u3059\u3002`@PathVariable(required=false)`\u3092\u4ed8\u3051\u305f\u3060\u3051\u3067`\/products`\u3078\u81ea\u52d5\u7684\u306b\u540c\u3058\u30e1\u30bd\u30c3\u30c9\u304c\u5bfe\u5fdc\u3059\u308b\u308f\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u7701\u7565\u3092\u8a31\u3059\u306a\u3089\u3001\u5225\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u3084\u30d1\u30bf\u30fc\u30f3\u3092\u8a2d\u8a08\u3057\u307e\u3059\u3002<\/p>\n<hr>\n<h2>@RequestParam\uff1a\u691c\u7d22\u6761\u4ef6\u3084\u30da\u30fc\u30b8\u756a\u53f7\u3092\u53d7\u3051\u53d6\u308b<\/h2>\n<p>\u4e00\u89a7\u30da\u30fc\u30b8\u306e\u300c\u30ab\u30c6\u30b4\u30ea\u300d\u3068\u300c\u4f55\u30da\u30fc\u30b8\u76ee\u304b\u300d\u306f\u3001\u901a\u5e38\u306f\u7279\u5b9a\u30ea\u30bd\u30fc\u30b9\u305d\u306e\u3082\u306e\u3067\u306f\u306a\u304f\u7d50\u679c\u3092\u8abf\u6574\u3059\u308b\u6761\u4ef6\u3067\u3059\u3002`?`\u4ee5\u964d\u306e\u30af\u30a8\u30ea\u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u7f6e\u304f\u3068\u3001URL\u306e\u610f\u56f3\u304c\u898b\u3048\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><code>@RestController\r\n@RequestMapping(&quot;\/products&quot;)\r\nclass ProductSearchController {\r\n    private final ProductService products;\r\n\r\n    ProductSearchController(ProductService products) {\r\n        this.products = products;\r\n    }\r\n\r\n    @GetMapping\r\n    List&lt;ProductDto&gt; search(\r\n        @RequestParam(name = &quot;category&quot;, required = false) String category,\r\n        @RequestParam(name = &quot;page&quot;, defaultValue = &quot;0&quot;) int page\r\n    ) {\r\n        return products.search(category, page);\r\n    }\r\n}<\/code><\/pre>\n<p>`GET \/products?category=book&amp;page=2`\u306a\u3089`category`\u306b`book`\u3001`page`\u306b2\u304c\u5165\u308a\u307e\u3059\u3002`category`\u3092\u7701\u7565\u3057\u305f\u5834\u5408\u306f`null`\u3001`page`\u3092\u7701\u7565\u3057\u305f\u5834\u5408\u306f\u65e2\u5b9a\u5024\u306e0\u3068\u3057\u3066\u6271\u3044\u307e\u3059\u3002Spring MVC\u3067\u306f\u30af\u30a8\u30ea\u3060\u3051\u3067\u306a\u304f\u3001\u30d5\u30a9\u30fc\u30e0\u30c7\u30fc\u30bf\u306a\u3069\u306eServlet\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u3082`@RequestParam`\u306e\u5bfe\u8c61\u3067\u3059\u3002<\/p>\n<p>\u4e00\u89a7API\u3067\u306f\u4e0d\u6b63\u306a\u8ca0\u6570\u30da\u30fc\u30b8\u3084\u904e\u5927\u306a\u30b5\u30a4\u30ba\u304c\u9001\u3089\u308c\u3066\u3082\u5b89\u5168\u306b\u51e6\u7406\u3067\u304d\u308b\u3088\u3046\u3001\u5024\u306e\u691c\u8a3c\u3068\u4e0a\u9650\u8a2d\u5b9a\u3082\u5b9f\u88c5\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<hr>\n<h2>URL\u8a2d\u8a08\u306f\u300c\u5bfe\u8c61\u300d\u3068\u300c\u6761\u4ef6\u300d\u3092\u5206\u3051\u308b\u3068\u6c7a\u3081\u3084\u3059\u3044<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u3084\u308a\u305f\u3044\u3053\u3068<\/th>\n<th>URL\u4f8b<\/th>\n<th>\u63a8\u5968\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u5546\u54c11\u4ef6\u3092\u53d6\u5f97<\/td>\n<td>`\/products\/42`<\/td>\n<td>`@PathVariable`<\/td>\n<\/tr>\n<tr>\n<td>\u5546\u54c1\u4e00\u89a7\u3092\u30ab\u30c6\u30b4\u30ea\u3067\u691c\u7d22<\/td>\n<td>`\/products?category=book`<\/td>\n<td>`@RequestParam`<\/td>\n<\/tr>\n<tr>\n<td>\u5546\u54c1\u4e00\u89a7\u3092\u4e26\u3073\u66ff\u3048<\/td>\n<td>`\/products?sort=price`<\/td>\n<td>`@RequestParam`<\/td>\n<\/tr>\n<tr>\n<td>\u30e6\u30fc\u30b6\u30fc\u306e\u6ce8\u6587\u3092\u7279\u5b9a<\/td>\n<td>`\/users\/7\/orders\/19`<\/td>\n<td>`@PathVariable`\u3092\u8907\u6570<\/td>\n<\/tr>\n<tr>\n<td>\u6ce8\u6587\u4e00\u89a7\u3092\u65e5\u4ed8\u3067\u7d5e\u308b<\/td>\n<td>`\/users\/7\/orders?from=2026-10-01`<\/td>\n<td>\u30e6\u30fc\u30b6\u30fcID\u306f`@PathVariable`\u3001\u671f\u9593\u306f`@RequestParam`<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u305f\u3068\u3048\u3070\u30e6\u30fc\u30b6\u30fcID\u3092`?userId=7`\u3067\u6e21\u3059\u8a2d\u8a08\u3082\u6280\u8853\u7684\u306b\u4e0d\u53ef\u80fd\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u3053\u3053\u3067\u793a\u3057\u305f\u306e\u306fAPI\u8a2d\u8a08\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u4fdd\u3064\u305f\u3081\u306e\u4e00\u822c\u7684\u306a\u5224\u65ad\u57fa\u6e96\u3067\u3042\u3063\u3066\u3001\u30eb\u30fc\u30eb\u9055\u53cd\u3092\u6a5f\u68b0\u7684\u306b\u5224\u5b9a\u3059\u308b\u3082\u306e\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h2>\u540c\u3058Controller\u3067\u4e21\u65b9\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u3082\u3088\u3044<\/h2>\n<p>\u5b9f\u969b\u306eAPI\u3067\u306f\u3001\u5bfe\u8c61ID\u3068\u8868\u793a\u6761\u4ef6\u3092\u4e00\u7dd2\u306b\u6271\u3046\u30b1\u30fc\u30b9\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre><code>@GetMapping(&quot;\/{id}\/history&quot;)\r\nList&lt;HistoryDto&gt; history(\r\n    @PathVariable(&quot;id&quot;) Long id,\r\n    @RequestParam(name = &quot;limit&quot;, defaultValue = &quot;20&quot;) int limit\r\n) {\r\n    return historyService.find(id, limit);\r\n}<\/code><\/pre>\n<p>\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306a\u3089`GET \/products\/42\/history?limit=10`\u306e`42`\u306f\u5546\u54c1ID\u3001`10`\u306f\u8fd4\u3059\u4ef6\u6570\u306e\u6761\u4ef6\u3067\u3059\u3002\u4e0a\u9650\u30c1\u30a7\u30c3\u30af\u3084\u30a2\u30af\u30bb\u30b9\u6a29\u9650\u306e\u78ba\u8a8d\u306f\u5225\u9014\u5fc5\u8981\u3067\u3059\u3002URL\u306eID\u3092\u53d7\u3051\u53d6\u308c\u305f\u3053\u3068\u306f\u3001\u305d\u306e\u30ea\u30bd\u30fc\u30b9\u3078\u306e\u30a2\u30af\u30bb\u30b9\u8a31\u53ef\u3092\u5f97\u305f\u3053\u3068\u3092\u610f\u5473\u3057\u307e\u305b\u3093\u3002<\/p>\n<h2>\u5024\u304c\u53d6\u308c\u306a\u3044\u3068\u304d\u306e\u5207\u308a\u5206\u3051<\/h2>\n<ul>\n<li>`@PathVariable`\u304c\u7a7a\u306b\u306a\u308b \u2192 `@GetMapping`\u306e`{id}`\u3068`@PathVariable(&quot;id&quot;)`\u306e\u540d\u524d\u304c\u4e00\u81f4\u3057\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3059\u308b<\/li>\n<li>`@RequestParam`\u3092\u7701\u7565\u3059\u308b\u3068\u30a8\u30e9\u30fc \u2192 \u65e2\u5b9a\u3067\u5fc5\u9808\u306a\u306e\u3067\u3001\u5fc5\u8981\u306a\u3089`required=false`\u3084`defaultValue`\u3092\u6307\u5b9a\u3059\u308b<\/li>\n<li>\u6587\u5b57\u5217\u304b\u3089\u6570\u5024\u3078\u306e\u5909\u63db\u306b\u5931\u6557 \u2192 `Long`\u3084`int`\u306e\u5f15\u6570\u578b\u3068URL\u306e\u5165\u529b\u5024\u3092\u78ba\u8a8d\u3059\u308b<\/li>\n<li>URL\u304c404\u306b\u306a\u308b \u2192 \u5f15\u6570\u4ee5\u524d\u306b\u3001HTTP\u30e1\u30bd\u30c3\u30c9\u3068Controller\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u304c\u4e00\u81f4\u3057\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3059\u308b<\/li>\n<li>`@RequestBody`\u3068\u306e\u9055\u3044\u304c\u66d6\u6627 \u2192 \u30ea\u30af\u30a8\u30b9\u30c8\u672c\u6587\u306eJSON\u53d7\u4fe1\u3068URL\/\u30d5\u30a9\u30fc\u30e0\u30d1\u30e9\u30e1\u30fc\u30bf\u53d7\u4fe1\u306f\u7528\u9014\u3092\u5206\u3051\u308b<\/li>\n<\/ul>\n<p>\u6b20\u843d\u3057\u305f\u5fc5\u9808\u30af\u30a8\u30ea\u30d1\u30e9\u30e1\u30fc\u30bf\u3084\u6570\u5024\u5909\u63db\u5931\u6557\u3067\u306f\u3001Spring MVC\u306e\u6a19\u6e96\u69cb\u6210\u3067\u901a\u5e38\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30a8\u30e9\u30fc\u3068\u3057\u3066\u6271\u308f\u308c\u307e\u3059\u304c\u3001\u5b9f\u969b\u306eHTTP\u5fdc\u7b54\u306f\u4f8b\u5916\u30cf\u30f3\u30c9\u30e9\u3084\u30a2\u30d7\u30ea\u8a2d\u5b9a\u306b\u3088\u3063\u3066\u3082\u5909\u308f\u308a\u307e\u3059\u3002\u6b63\u78ba\u306b\u78ba\u8a8d\u3059\u308b\u306b\u306f\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306e\u7d50\u5408\u30c6\u30b9\u30c8\u3067\u5fdc\u7b54\u3092\u898b\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>@RequestBody\u3084@ModelAttribute\u3068\u6df7\u540c\u3057\u306a\u3044<\/h2>\n<p>JSON\u672c\u6587\u3092Java\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3078\u8aad\u307f\u8fbc\u3080`@RequestBody`\u3068\u3001\u30af\u30a8\u30ea\u30fb\u30d5\u30a9\u30fc\u30e0\u30fb\u30d1\u30b9\u3092\u6271\u3046\u4eca\u56de\u306e2\u3064\u306f\u7528\u9014\u304c\u7570\u306a\u308a\u307e\u3059\u3002\u30d5\u30a9\u30fc\u30e0\u5168\u4f53\u3092\u307e\u3068\u3081\u3066\u53d7\u3051\u53d6\u308b\u306a\u3089`@ModelAttribute`\u3082\u9078\u629e\u80a2\u3067\u3059\u3002\u65e2\u5b58\u8a18\u4e8b\u3067\u306f\u3001\u3053\u306e2\u3064\u306e\u9055\u3044\u3092\u8a73\u3057\u304f\u6574\u7406\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\uff08\u30d5\u30a9\u30fc\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u53d7\u3051\u53d6\u308a\u65b9\u3092\u78ba\u8a8d\u3059\u308b\u306b\u3064\u3044\u3066\u306f\u300e<a href=\"https:\/\/route-zero.com\/recruit\/route\/1336\/\">\u3010\u521d\u5fc3\u8005\u5411\u3051\u3011Spring Boot \u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u53d7\u3051\u53d6\u308a\uff5c@ModelAttribute \u3068 @RequestBody \u306e\u9055\u3044\u3068\u4f7f\u3044\u5206\u3051<\/a>\u300f\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\uff09<\/p>\n<p>\u307e\u305f\u3001`@GetMapping`\u3068`@PostMapping`\u306fHTTP\u30e1\u30bd\u30c3\u30c9\u3092\u3069\u306e\u51e6\u7406\u3078\u7d50\u3073\u4ed8\u3051\u308b\u304b\u3068\u3044\u3046\u5225\u306e\u8a71\u3067\u3059\u3002<\/p>\n<p>\uff08GET\u3068POST\u306e\u9055\u3044\u3092\u6574\u7406\u3059\u308b\u306b\u3064\u3044\u3066\u306f\u300e<a href=\"https:\/\/route-zero.com\/recruit\/route\/1299\/\">Spring Boot\u3067\u7406\u89e3\u3059\u308bGET\u3068POST\u306e\u9055\u3044\uff5cThymeleaf\u5b9f\u88c5\u4f8b\u4ed8\u304d\u3067\u521d\u5fc3\u8005\u306e\u753b\u9762\u9077\u79fb\u30fb\u30a8\u30e9\u30fc\u5bfe\u5fdc\u307e\u3067\u4e01\u5be7\u89e3\u8aac<\/a>\u300f\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\uff09<\/p>\n<h2>\u3088\u304f\u3042\u308b\u8cea\u554f<\/h2>\n<h3>\u30d1\u30b9\u306b\u691c\u7d22\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u5165\u308c\u3066\u3082\u52d5\u304d\u307e\u3059\u304b\uff1f<\/h3>\n<p>URI\u30d1\u30bf\u30fc\u30f3\u3068\u3057\u3066\u30de\u30c3\u30d4\u30f3\u30b0\u3067\u304d\u308c\u3070\u53d7\u3051\u53d6\u308c\u307e\u3059\u3002\u305f\u3060\u3057\u691c\u7d22\u8a9e\u3084\u7d5e\u308a\u8fbc\u307f\u6761\u4ef6\u306f\u5909\u5316\u30fb\u7d44\u5408\u305b\u304c\u591a\u3044\u305f\u3081\u3001\u901a\u5e38\u306f\u30af\u30a8\u30ea\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u65b9\u304c\u6271\u3044\u3084\u3059\u3044\u8a2d\u8a08\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>@PathVariable\u3068@RequestParam\u30921\u3064\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u4f7f\u3048\u307e\u3059\u304b\uff1f<\/h3>\n<p>\u306f\u3044\u3002\u30d1\u30b9\u5185\u306e\u5bfe\u8c61ID\u3068\u30af\u30a8\u30ea\u306e\u30d5\u30a3\u30eb\u30bf\u6761\u4ef6\u3092\u540c\u6642\u306b\u5f15\u6570\u3078\u53d7\u3051\u53d6\u308c\u307e\u3059\u3002`\/products\/42\/history?limit=10`\u306a\u3069\u304c\u4e00\u4f8b\u3067\u3059\u3002<\/p>\n<h3>@RequestParam\u306erequired=false\u3068defaultValue\u306e\u9055\u3044\u306f\uff1f<\/h3>\n<p>`required=false`\u306f\u7701\u7565\u3092\u8a31\u3057\u3066\u3001\u5024\u304c\u306a\u3051\u308c\u3070null\u306a\u3069\u3067\u53d7\u3051\u53d6\u308b\u4f7f\u3044\u65b9\u3067\u3059\u3002`defaultValue`\u306f\u672a\u6307\u5b9a\u3084\u7a7a\u5024\u306b\u4ee3\u5165\u3059\u308b\u65e2\u5b9a\u5024\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<h3>@PathVariable\u306eID\u306f\u5b89\u5168\u306a\u5024\u3067\u3059\u304b\uff1f<\/h3>\n<p>\u3044\u3044\u3048\u3002URL\u306e\u5024\u306f\u5916\u90e8\u5165\u529b\u3067\u3059\u3002\u578b\u5909\u63db\u3060\u3051\u306b\u983c\u3089\u305a\u3001\u5fc5\u8981\u306a\u5165\u529b\u691c\u8a3c\u3068\u8a8d\u53ef\u3092\u5fc5\u305a\u884c\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u307e\u3068\u3081\uff1a\u8a73\u7d30ID\u306f\u30d1\u30b9\u3001\u4e00\u89a7\u306e\u7d5e\u308a\u8fbc\u307f\u306f\u30af\u30a8\u30ea\u3092\u7b2c\u4e00\u5019\u88dc\u306b<\/h2>\n<ul>\n<li>`@PathVariable`\u306fURL\u306e`{id}`\u306a\u3069\u3092\u53d6\u308a\u51fa\u3057\u3001\u7279\u5b9a\u5bfe\u8c61\u306e\u8b58\u5225\u5b50\u306b\u5411\u304f\u3002<\/li>\n<li>`@RequestParam`\u306f\u30af\u30a8\u30ea\u3084\u30d5\u30a9\u30fc\u30e0\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u53d6\u308a\u51fa\u3057\u3001\u691c\u7d22\u6761\u4ef6\u3084\u30da\u30fc\u30b8\u756a\u53f7\u306b\u5411\u304f\u3002<\/li>\n<li>\u7701\u7565\u6642\u306e\u6271\u3044\u306f\u7570\u306a\u308b\u3002\u30de\u30c3\u30d4\u30f3\u30b0\u305d\u306e\u3082\u306e\u3068\u3001\u5f15\u6570\u304c\u5fc5\u9808\u304b\u3069\u3046\u304b\u3092\u5206\u3051\u3066\u8003\u3048\u308b\u3002<\/li>\n<li>HTTP\u30e1\u30bd\u30c3\u30c9\u3001\u5165\u529b\u691c\u8a3c\u3001\u8a8d\u53ef\u306f\u5225\u306e\u8a2d\u8a08\u8981\u7d20\u3068\u3057\u3066\u78ba\u8a8d\u3059\u308b\u3002<\/li>\n<\/ul>\n<p>\u65e2\u5b58\u306eController\u3067`@GetMapping`\u306eURL\u30d1\u30bf\u30fc\u30f3\u3092\u78ba\u8a8d\u3057\u3001\u5404\u5f15\u6570\u304c\u300c\u5bfe\u8c61\u300d\u306a\u306e\u304b\u300c\u6761\u4ef6\u300d\u306a\u306e\u304b\u3092\u5206\u985e\u3059\u308b\u3068\u3053\u308d\u304b\u3089\u59cb\u3081\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"featured_media":6436,"template":"","meta":{"ssp_meta_title":"Spring Boot\u306eURL\u8a2d\u8a08\uff5cPathVariable\u3068RequestParam\u306e\u4f7f\u3044\u5206\u3051","ssp_meta_description":"Spring Boot\u306e@RequestParam\u3068@PathVariable\u306e\u9055\u3044\u3092URL\u4f8b\u3068\u6bd4\u8f03\u8868\u3067\u89e3\u8aac\u3002\u8a73\u7d30ID\u306f\u30d1\u30b9\u3001\u691c\u7d22\u6761\u4ef6\u306f\u30af\u30a8\u30ea\u3068\u3044\u3046\u5224\u65ad\u57fa\u6e96\u3001required\u3084defaultValue\u3001\u4e21\u65b9\u3092\u4f7f\u3046Controller\u4f8b\u307e\u3067\u6574\u7406\u3057\u307e\u3059\u3002","ssp_meta_keyword":"Spring Boot RequestParam PathVariable \u9055\u3044,Spring Boot @RequestParam,Spring Boot @PathVariable,Spring MVC Query Parameter,PathVariable required false,RequestParam defaultValue,Spring Boot URL\u8a2d\u8a08","ssp_meta_canonical":""},"route_category":[9],"_links":{"self":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/route\/6431"}],"collection":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/route"}],"about":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/types\/route"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/media\/6436"}],"wp:attachment":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/media?parent=6431"}],"wp:term":[{"taxonomy":"route_category","embeddable":true,"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/route_category?post=6431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}