{"id":106,"date":"2019-03-09T11:28:46","date_gmt":"2019-03-09T11:28:46","guid":{"rendered":"https:\/\/www.kindsonthegenius.com\/spring-boot\/?p=106"},"modified":"2019-03-12T14:23:06","modified_gmt":"2019-03-12T14:23:06","slug":"13-spring-boot-write-update-methods","status":"publish","type":"post","link":"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/","title":{"rendered":"Spring Boot &#8211; Write UPDATE Methods"},"content":{"rendered":"<p>In this chapter, we are going to write the Update Methods (PUT) to update records.<\/p>\n<p>So this follows from the same procedure as with the POST methods.<\/p>\n<p>&nbsp;<\/p>\n<ol>\n<li><a href=\"#t1\">Write the updateLocation Methods<\/a><\/li>\n<li><a href=\"#t2\">Write the updateUser Methods<\/a><\/li>\n<li><a href=\"#t3\">Write the updatePost Methods<\/a><\/li>\n<li><a href=\"#t4\">Test the Application<\/a><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t1\">1. Write the updateLocation Methods<\/strong><\/h4>\n<p>Open the LocationController file and write the updateLocation method as shown below<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #555555; font-weight: bold;\">@RequestMapping<\/span><span style=\"color: #333333;\">(<\/span>value <span style=\"color: #333333;\">=<\/span> <span style=\"background-color: #fff0f0;\">\"\/locations\/{id}\"<\/span><span style=\"color: #333333;\">,<\/span> method <span style=\"color: #333333;\">=<\/span> RequestMethod<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">PUT<\/span><span style=\"color: #333333;\">)<\/span>\r\n<span style=\"color: #008800; font-weight: bold;\">public<\/span> <span style=\"color: #333399; font-weight: bold;\">void<\/span> <span style=\"color: #0066bb; font-weight: bold;\">updateLocation<\/span><span style=\"color: #333333;\">(<\/span><span style=\"color: #555555; font-weight: bold;\">@RequestBody<\/span> Location location<span style=\"color: #333333;\">,<\/span> <span style=\"color: #555555; font-weight: bold;\">@PathVariable<\/span> String id<span style=\"color: #333333;\">)<\/span> <span style=\"color: #333333;\">{\r\n<\/span>\r\n     locationService<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">updateLocation<\/span><span style=\"color: #333333;\">(<\/span>id<span style=\"color: #333333;\">,<\/span> location<span style=\"color: #333333;\">);\r\n<\/span>\r\n<span style=\"color: #333333;\">}<\/span><\/pre>\n<p>Listing 1.0:updateLocation for the LocaitonController<\/p>\n<p>&nbsp;<\/p>\n<p>After you write this code, you will have an error. So you need to\u00a0add the updateLocation method in the LocationService file as shown below<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #008800; font-weight: bold;\">public<\/span> <span style=\"color: #333399; font-weight: bold;\">void<\/span> <span style=\"color: #0066bb; font-weight: bold;\">updateLocation<\/span><span style=\"color: #333333;\">(<\/span>String id<span style=\"color: #333333;\">,<\/span> Location location<span style=\"color: #333333;\">)<\/span> <span style=\"color: #333333;\">{\r\n<\/span>\r\n   <span style=\"color: #008800; font-weight: bold;\">for<\/span><span style=\"color: #333333;\">(<\/span><span style=\"color: #333399; font-weight: bold;\">int<\/span> i <span style=\"color: #333333;\">=<\/span> <span style=\"color: #0000dd; font-weight: bold;\">0<\/span><span style=\"color: #333333;\">;<\/span> i <span style=\"color: #333333;\">&lt;<\/span> locations<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">size<\/span><span style=\"color: #333333;\">();<\/span> i<span style=\"color: #333333;\">++)<\/span> <span style=\"color: #333333;\">{\r\n<\/span>\r\n\tLocation l <span style=\"color: #333333;\">=<\/span> locations<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">get<\/span><span style=\"color: #333333;\">(<\/span>i<span style=\"color: #333333;\">);\r\n<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold;\">if<\/span> <span style=\"color: #333333;\">(<\/span>l<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">getId<\/span><span style=\"color: #333333;\">().<\/span><span style=\"color: #0000cc;\">equals<\/span><span style=\"color: #333333;\">(<\/span>id<span style=\"color: #333333;\">))<\/span> <span style=\"color: #333333;\">{<\/span>\r\n\t    locations<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">set<\/span><span style=\"color: #333333;\">(<\/span>i<span style=\"color: #333333;\">,<\/span> location<span style=\"color: #333333;\">);<\/span>\r\n\t<span style=\"color: #333333;\">}<\/span>\r\n   <span style=\"color: #333333;\">}<\/span>\t\t\r\n<span style=\"color: #333333;\">}<\/span>\r\n<\/pre>\n<p>Listing 1.1: updateLocation for the LocationService class<\/p>\n<p>&nbsp;<\/p>\n<p>In the code above, we simply loop through the collection to find a matching id. Then we replace location at that position with the passed in Location.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t2\">2. Write the updateUser Methods<\/strong><\/h4>\n<p>Open the UserController file and write the updateUser method as shown below<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #555555; font-weight: bold;\">@RequestMapping<\/span><span style=\"color: #333333;\">(<\/span>value<span style=\"color: #333333;\">=<\/span><span style=\"background-color: #fff0f0;\">\"\/users\/{id}\"<\/span><span style=\"color: #333333;\">,<\/span> method <span style=\"color: #333333;\">=<\/span> RequestMethod<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">PUT<\/span><span style=\"color: #333333;\">)\r\n<\/span><span style=\"color: #008800; font-weight: bold;\">public<\/span> <span style=\"color: #333399; font-weight: bold;\">void<\/span> <span style=\"color: #0066bb; font-weight: bold;\">getUser<\/span><span style=\"color: #333333;\">(<\/span><span style=\"color: #555555; font-weight: bold;\">@PathVariable<\/span> String id<span style=\"color: #333333;\">,<\/span> <span style=\"color: #555555; font-weight: bold;\">@RequestBody<\/span> User user<span style=\"color: #333333;\">)<\/span> <span style=\"color: #333333;\">{\r\n<\/span>\r\n    userService<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">updateUser<\/span><span style=\"color: #333333;\">(<\/span>id<span style=\"color: #333333;\">,<\/span> user<span style=\"color: #333333;\">);\r\n<\/span>\r\n<span style=\"color: #333333;\">}<\/span>\r\n<\/pre>\n<p>Listing 1.2: updateUser for the UserController class<\/p>\n<p>&nbsp;<\/p>\n<p>Similarly, add the updateUser method in the UserService file as shown below<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #008800; font-weight: bold;\">public<\/span> <span style=\"color: #333399; font-weight: bold;\">void<\/span> <span style=\"color: #0066bb; font-weight: bold;\">updateUser<\/span><span style=\"color: #333333;\">(<\/span>String id<span style=\"color: #333333;\">,<\/span> User user<span style=\"color: #333333;\">)<\/span> <span style=\"color: #333333;\">{\r\n<\/span>\r\n    <span style=\"color: #008800; font-weight: bold;\">for<\/span><span style=\"color: #333333;\">(<\/span><span style=\"color: #333399; font-weight: bold;\">int<\/span> i <span style=\"color: #333333;\">=<\/span> <span style=\"color: #0000dd; font-weight: bold;\">0<\/span><span style=\"color: #333333;\">;<\/span> i <span style=\"color: #333333;\">&lt;<\/span> users<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">size<\/span><span style=\"color: #333333;\">();<\/span> i<span style=\"color: #333333;\">++)<\/span> <span style=\"color: #333333;\">{\r\n<\/span>\r\n\tUser u <span style=\"color: #333333;\">=<\/span> users<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">get<\/span><span style=\"color: #333333;\">(<\/span>i<span style=\"color: #333333;\">);\r\n<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold;\">if<\/span><span style=\"color: #333333;\">(<\/span>u<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">getId<\/span><span style=\"color: #333333;\">().<\/span><span style=\"color: #0000cc;\">equals<\/span><span style=\"color: #333333;\">(<\/span>id<span style=\"color: #333333;\">))<\/span> <span style=\"color: #333333;\">{\r\n<\/span>\r\n\t     users<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">set<\/span><span style=\"color: #333333;\">(<\/span>i<span style=\"color: #333333;\">,<\/span> user<span style=\"color: #333333;\">);\r\n<\/span>\r\n\t     <span style=\"color: #008800; font-weight: bold;\">return<\/span><span style=\"color: #333333;\">;<\/span>\r\n\t<span style=\"color: #333333;\">}<\/span>\r\n    <span style=\"color: #333333;\">}<\/span>\r\n<span style=\"color: #333333;\">}<\/span>\r\n<\/pre>\n<p>Listing 1.3:updateUser for the UserService class<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t3\">3. Write the updatePost Methods<\/strong><\/h4>\n<p>Open the PostController file and write the updatedPost method as shown below.<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #555555; font-weight: bold;\">@RequestMapping<\/span><span style=\"color: #333333;\">(<\/span>value<span style=\"color: #333333;\">=<\/span><span style=\"background-color: #fff0f0;\">\"\/posts\/{id}\"<\/span><span style=\"color: #333333;\">,<\/span> method <span style=\"color: #333333;\">=<\/span> RequestMethod<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">PUT<\/span><span style=\"color: #333333;\">)\r\n<\/span><span style=\"color: #008800; font-weight: bold;\">public<\/span> <span style=\"color: #333399; font-weight: bold;\">void<\/span> <span style=\"color: #0066bb; font-weight: bold;\">updatePost<\/span><span style=\"color: #333333;\">(<\/span><span style=\"color: #555555; font-weight: bold;\">@PathVariable<\/span> String id<span style=\"color: #333333;\">,<\/span> <span style=\"color: #555555; font-weight: bold;\">@RequestBody<\/span> Post post<span style=\"color: #333333;\">)<\/span> <span style=\"color: #333333;\">{\r\n<\/span>\r\n      postService<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">updatePost<\/span><span style=\"color: #333333;\">(<\/span>id<span style=\"color: #333333;\">,<\/span> post<span style=\"color: #333333;\">);\r\n<\/span>\r\n<span style=\"color: #333333;\">}<\/span>\r\n<\/pre>\n<p>Listing 1.4: updatePost for the PostController class<\/p>\n<p>&nbsp;<\/p>\n<p>Similarly, add the updatePost method in the LocationService file as shown below<br \/>\n<!-- HTML generated using hilite.me --><\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #008800; font-weight: bold;\">public<\/span> <span style=\"color: #333399; font-weight: bold;\">void<\/span> <span style=\"color: #0066bb; font-weight: bold;\">updatePost<\/span><span style=\"color: #333333;\">(<\/span>String id<span style=\"color: #333333;\">,<\/span> Post post<span style=\"color: #333333;\">)<\/span> <span style=\"color: #333333;\">{<\/span>\r\n\r\n    <span style=\"color: #008800; font-weight: bold;\">for<\/span><span style=\"color: #333333;\">(<\/span><span style=\"color: #333399; font-weight: bold;\">int<\/span> i <span style=\"color: #333333;\">=<\/span> <span style=\"color: #0000dd; font-weight: bold;\">0<\/span><span style=\"color: #333333;\">;<\/span> i <span style=\"color: #333333;\">&lt;<\/span> posts<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">size<\/span><span style=\"color: #333333;\">();<\/span> i<span style=\"color: #333333;\">++)<\/span> <span style=\"color: #333333;\">{<\/span>\r\n\r\n\tPost p <span style=\"color: #333333;\">=<\/span> posts<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">get<\/span><span style=\"color: #333333;\">(<\/span>i<span style=\"color: #333333;\">);<\/span>\r\n\r\n\t<span style=\"color: #008800; font-weight: bold;\">if<\/span><span style=\"color: #333333;\">(<\/span>p<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">equals<\/span><span style=\"color: #333333;\">(<\/span>post<span style=\"color: #333333;\">))<\/span> <span style=\"color: #333333;\">{\r\n<\/span>\r\n\t     posts<span style=\"color: #333333;\">.<\/span><span style=\"color: #0000cc;\">set<\/span><span style=\"color: #333333;\">(<\/span>i<span style=\"color: #333333;\">,<\/span> post<span style=\"color: #333333;\">);<\/span>\r\n\t<span style=\"color: #333333;\">}<\/span>\r\n    <span style=\"color: #333333;\">}<\/span>\r\n<span style=\"color: #333333;\">}<\/span>\r\n<\/pre>\n<p>Listing 1.5:updatePost for the postService class<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t4\">4. Test the Application<\/strong><\/h4>\n<p>Now, you can use Advanced REST Client to test the update methods.<\/p>\n<p>You do it almost the same way as the POST methods. But this time you need to specify the id in the url as well.<\/p>\n<p>I recommend you watch the video.<\/p>\n<p>Next, we would write the DELETE methods.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>In this chapter, we are going to write the Update Methods (PUT) to update records. So this follows from the same procedure as with the &hellip; <!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":108,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-106","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-spring-boot-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Spring Boot - Write UPDATE Methods - Learn Spring Boot<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Boot - Write UPDATE Methods - Learn Spring Boot\" \/>\n<meta property=\"og:description\" content=\"In this chapter, we are going to write the Update Methods (PUT) to update records. So this follows from the same procedure as with the &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/\" \/>\n<meta property=\"og:site_name\" content=\"Learn Spring Boot\" \/>\n<meta property=\"article:published_time\" content=\"2019-03-09T11:28:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-12T14:23:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/sites\/7\/2019\/03\/UPDATE-Methods.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"781\" \/>\n\t<meta property=\"og:image:height\" content=\"451\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"kindsonthegenius\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"kindsonthegenius\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/13-spring-boot-write-update-methods\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/13-spring-boot-write-update-methods\\\/\"},\"author\":{\"name\":\"kindsonthegenius\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/#\\\/schema\\\/person\\\/7f8fc5792578d2ff54003fcebe6c46b5\"},\"headline\":\"Spring Boot &#8211; Write UPDATE Methods\",\"datePublished\":\"2019-03-09T11:28:46+00:00\",\"dateModified\":\"2019-03-12T14:23:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/13-spring-boot-write-update-methods\\\/\"},\"wordCount\":272,\"commentCount\":6,\"image\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/13-spring-boot-write-update-methods\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/wp-content\\\/uploads\\\/sites\\\/7\\\/2019\\\/03\\\/UPDATE-Methods.jpg\",\"articleSection\":[\"Spring Boot Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/13-spring-boot-write-update-methods\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/13-spring-boot-write-update-methods\\\/\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/13-spring-boot-write-update-methods\\\/\",\"name\":\"Spring Boot - Write UPDATE Methods - Learn Spring Boot\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/13-spring-boot-write-update-methods\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/13-spring-boot-write-update-methods\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/wp-content\\\/uploads\\\/sites\\\/7\\\/2019\\\/03\\\/UPDATE-Methods.jpg\",\"datePublished\":\"2019-03-09T11:28:46+00:00\",\"dateModified\":\"2019-03-12T14:23:06+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/#\\\/schema\\\/person\\\/7f8fc5792578d2ff54003fcebe6c46b5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/13-spring-boot-write-update-methods\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/13-spring-boot-write-update-methods\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/13-spring-boot-write-update-methods\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/wp-content\\\/uploads\\\/sites\\\/7\\\/2019\\\/03\\\/UPDATE-Methods.jpg\",\"contentUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/wp-content\\\/uploads\\\/sites\\\/7\\\/2019\\\/03\\\/UPDATE-Methods.jpg\",\"width\":781,\"height\":451},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/13-spring-boot-write-update-methods\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spring Boot &#8211; Write UPDATE Methods\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/#website\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/\",\"name\":\"Learn Spring Boot\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/#\\\/schema\\\/person\\\/7f8fc5792578d2ff54003fcebe6c46b5\",\"name\":\"kindsonthegenius\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g\",\"caption\":\"kindsonthegenius\"},\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/spring-boot\\\/author\\\/kindsonthegenius-3\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Boot - Write UPDATE Methods - Learn Spring Boot","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/","og_locale":"en_US","og_type":"article","og_title":"Spring Boot - Write UPDATE Methods - Learn Spring Boot","og_description":"In this chapter, we are going to write the Update Methods (PUT) to update records. So this follows from the same procedure as with the &hellip;","og_url":"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/","og_site_name":"Learn Spring Boot","article_published_time":"2019-03-09T11:28:46+00:00","article_modified_time":"2019-03-12T14:23:06+00:00","og_image":[{"width":781,"height":451,"url":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/sites\/7\/2019\/03\/UPDATE-Methods.jpg","type":"image\/jpeg"}],"author":"kindsonthegenius","twitter_card":"summary_large_image","twitter_misc":{"Written by":"kindsonthegenius","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/#article","isPartOf":{"@id":"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/"},"author":{"name":"kindsonthegenius","@id":"https:\/\/www.kindsonthegenius.com\/spring-boot\/#\/schema\/person\/7f8fc5792578d2ff54003fcebe6c46b5"},"headline":"Spring Boot &#8211; Write UPDATE Methods","datePublished":"2019-03-09T11:28:46+00:00","dateModified":"2019-03-12T14:23:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/"},"wordCount":272,"commentCount":6,"image":{"@id":"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/sites\/7\/2019\/03\/UPDATE-Methods.jpg","articleSection":["Spring Boot Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/","url":"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/","name":"Spring Boot - Write UPDATE Methods - Learn Spring Boot","isPartOf":{"@id":"https:\/\/www.kindsonthegenius.com\/spring-boot\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/#primaryimage"},"image":{"@id":"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/sites\/7\/2019\/03\/UPDATE-Methods.jpg","datePublished":"2019-03-09T11:28:46+00:00","dateModified":"2019-03-12T14:23:06+00:00","author":{"@id":"https:\/\/www.kindsonthegenius.com\/spring-boot\/#\/schema\/person\/7f8fc5792578d2ff54003fcebe6c46b5"},"breadcrumb":{"@id":"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/#primaryimage","url":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/sites\/7\/2019\/03\/UPDATE-Methods.jpg","contentUrl":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-content\/uploads\/sites\/7\/2019\/03\/UPDATE-Methods.jpg","width":781,"height":451},{"@type":"BreadcrumbList","@id":"https:\/\/www.kindsonthegenius.com\/spring-boot\/13-spring-boot-write-update-methods\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.kindsonthegenius.com\/spring-boot\/"},{"@type":"ListItem","position":2,"name":"Spring Boot &#8211; Write UPDATE Methods"}]},{"@type":"WebSite","@id":"https:\/\/www.kindsonthegenius.com\/spring-boot\/#website","url":"https:\/\/www.kindsonthegenius.com\/spring-boot\/","name":"Learn Spring Boot","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.kindsonthegenius.com\/spring-boot\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.kindsonthegenius.com\/spring-boot\/#\/schema\/person\/7f8fc5792578d2ff54003fcebe6c46b5","name":"kindsonthegenius","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g","caption":"kindsonthegenius"},"url":"https:\/\/www.kindsonthegenius.com\/spring-boot\/author\/kindsonthegenius-3\/"}]}},"_links":{"self":[{"href":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/posts\/106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/comments?post=106"}],"version-history":[{"count":3,"href":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/posts\/106\/revisions"}],"predecessor-version":[{"id":111,"href":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/posts\/106\/revisions\/111"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/media\/108"}],"wp:attachment":[{"href":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/media?parent=106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/categories?post=106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/spring-boot\/wp-json\/wp\/v2\/tags?post=106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}