{"id":98343,"date":"2019-09-17T13:00:03","date_gmt":"2019-09-17T10:00:03","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=98343"},"modified":"2019-09-16T10:53:12","modified_gmt":"2019-09-16T07:53:12","slug":"spring-boot-building-restful-web-application","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html","title":{"rendered":"Spring Boot: Building a RESTful Web Application"},"content":{"rendered":"<h3 class=\"wp-block-heading\">Introduction:<\/h3>\n<p><em>REST<\/em> stands for <em>Representational State Transfe<\/em>r and is an architectural guideline for API design. We assume that you already have a background in building RESTful APIs.<\/p>\n<p>In this tutorial, we\u2019ll design a simple Spring Boot RESTful web application, exposing a few REST endpoints.<\/p>\n<h3 class=\"wp-block-heading\">Project Setup:<\/h3>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"881\" height=\"625\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/09\/SpringInitializrRESTful.png\" alt=\"\" class=\"wp-image-98367\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/09\/SpringInitializrRESTful.png 881w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/09\/SpringInitializrRESTful-300x213.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2019\/09\/SpringInitializrRESTful-768x545.png 768w\" sizes=\"(max-width: 881px) 100vw, 881px\" \/><\/figure>\n<\/div>\n<p>Let\u2019s start by downloading the project template via <a href=\"https:\/\/start.spring.io\">Spring Initializr:<\/a><\/p>\n<p>We only need to add <em>\u2018Spring Web\u2019<\/em> as an extra starter dependency for RESTful web applications. We have added the other two assuming we\u2019re interacting with the database as well.<\/p>\n<h3 class=\"wp-block-heading\"><em>POM<\/em> file:<\/h3>\n<p>Our <em>POM<\/em> file will now have all the needed web application and database dependencies:<\/p>\n<pre class=\"wp-block-preformatted brush:xhtml\">&lt;dependency&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;artifactId&gt;spring-boot-starter&lt;\/artifactId&gt;\n&lt;\/dependency&gt;\n&lt;dependency&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;\n&lt;\/dependency&gt;\n&lt;dependency&gt; \n&nbsp;&nbsp;&nbsp;&nbsp;&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;\n&lt;\/dependency&gt;\n&lt;dependency&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;artifactId&gt;spring-boot-starter-data-jpa&lt;\/artifactId&gt;\n&lt;\/dependency&gt;\n&lt;dependency&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;groupId&gt;com.h2database&lt;\/groupId&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;artifactId&gt;h2&lt;\/artifactId&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;scope&gt;runtime&lt;\/scope&gt;\n&lt;\/dependency&gt;\n<\/pre>\n<h3 class=\"wp-block-heading\">REST Controller:<\/h3>\n<p>Let\u2019s now define our REST controller:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"wp-block-preformatted brush:java\">@RestController\n@RequestMapping(\"\/student\")\npublic class StudentController {\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;@Autowired\n&nbsp;&nbsp;&nbsp;&nbsp;private StudentService studentService;\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;@GetMapping(\"\/all\")\n&nbsp;&nbsp;&nbsp;&nbsp;public ResponseEntity&lt;List&lt;Student&gt;&gt; getAllStudents() {\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return new ResponseEntity&lt;List&lt;Student&gt;&gt;(studentService.getAllStudents()\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;, HttpStatus.OK);\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;@GetMapping(\"\/{id}\") \n&nbsp;&nbsp;&nbsp;&nbsp;public ResponseEntity&lt;Student&gt; getStudentById(@PathVariable(\"id\") Integer id) {\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Optional&lt;Student&gt; student = studentService.getById(id);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(student.isPresent())\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return new ResponseEntity&lt;Student&gt;(student.get(), HttpStatus.OK);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else \n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw new ResponseStatusException(HttpStatus.NOT_FOUND\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;, \"No student found!\"); \n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;@PostMapping(\"\/\")\n&nbsp;&nbsp;&nbsp;&nbsp;public ResponseEntity&lt;Student&gt; createStudent(@RequestBody\n&nbsp;&nbsp;&nbsp;&nbsp; Student student) {\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Student newStudent = studentService.store(student);\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return new ResponseEntity&lt;Student&gt;(newStudent, HttpStatus.CREATED);\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;...\n}\n<\/pre>\n<p>We can define all our <em>GET, POST, DELETE<\/em> or <em>PUT<\/em> mappings in our controller.<\/p>\n<h3 class=\"wp-block-heading\">Service:<\/h3>\n<p>Here, the <em>StudentService<\/em> is the class interacting with the database and doing all the operations for us:<\/p>\n<pre class=\"wp-block-preformatted brush:java\">@Service\npublic class StudentService {\n&nbsp;&nbsp;&nbsp;&nbsp;@Autowired\n&nbsp;&nbsp;&nbsp;&nbsp;private StudentRepository repo;\n&nbsp;&nbsp;&nbsp;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;public Student store(Student student) {\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return repo.save(student);\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;public List&lt;Student&gt; getAllStudents() {\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return repo.findAll();\n&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;...\n&nbsp;\n}\n<\/pre>\n<p>We have another tutorial explaining how to configure the <a href=\"https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-with-h2-database.html\">H2 database with Spring Boot.<\/a><\/p>\n<h3 class=\"wp-block-heading\">Running the Application:<\/h3>\n<p>Finally, we can run our <em>UniversityApplication<\/em> class:<\/p>\n<pre class=\"wp-block-preformatted brush:java\">@SpringBootApplication\npublic class UniversityApplication {\n&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;public static void main(String[] args) {\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SpringApplication.run(UniversityApplication.class, args);\n&nbsp;&nbsp;&nbsp;&nbsp;}\n}\n<\/pre>\n<p>With which our <em>REST<\/em> endpoints will be exposed on the embedded server.<\/p>\n<h3 class=\"wp-block-heading\">Testing REST Endpoints:<\/h3>\n<p>Let\u2019s use cURL to test out our REST endpoint:<\/p>\n<pre class=\"wp-block-preformatted brush:shell\">$ curl http:\/\/localhost:8080\/student\/all\n<\/pre>\n<p>This will return all the student records present in our database:<\/p>\n<pre class=\"wp-block-preformatted brush:java\">[{1, \"James\"}, {2, \"Selena\"}, {3, \"John\"}]\n<\/pre>\n<p>Similarly, we have:<\/p>\n<pre class=\"wp-block-preformatted brush:shell\">$ curl http:\/\/localhost:8080\/student\/1\n{1, \"James\"}\n<\/pre>\n<p>We can also use <em>POSTman<\/em> tool to test our endpoints. It has a great user-interface.<\/p>\n<h3 class=\"wp-block-heading\">Conclusion:<\/h3>\n<p>In this tutorial, we built a Spring Boot RESTful application from scratch. We exposed a few API and then tested them using cURL.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>\n<p>Published on Java Code Geeks with permission by Shubhra Srivastava, partner at our <a href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener noreferrer\">JCG program<\/a>. See the original article here: <a href=\"http:\/\/www.programmergirl.com\/spring-boot-restful-web-application\/\" target=\"_blank\" rel=\"noopener noreferrer\">Spring Boot: Building a RESTful Web Application<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: REST stands for Representational State Transfer and is an architectural guideline for API design. We assume that you already have a background in building RESTful APIs. In this tutorial, we\u2019ll design a simple Spring Boot RESTful web application, exposing a few REST endpoints. Project Setup: Let\u2019s start by downloading the project template via Spring &hellip;<\/p>\n","protected":false},"author":82253,"featured_media":240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[815,854,1898],"class_list":["post-98343","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-rest","tag-spring-boot","tag-web-app"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Spring Boot: Building a RESTful Web Application - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn about RESTful Web Application? Check our article designing a simple Spring Boot RESTful web application, exposing a few REST endpoints\" \/>\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.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring Boot: Building a RESTful Web Application - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn about RESTful Web Application? Check our article designing a simple Spring Boot RESTful web application, exposing a few REST endpoints\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2019-09-17T10:00:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Shubhra Srivastava\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shubhra Srivastava\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/09\\\/spring-boot-building-restful-web-application.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/09\\\/spring-boot-building-restful-web-application.html\"},\"author\":{\"name\":\"Shubhra Srivastava\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/b73b076dc62e72de203df7018d398e56\"},\"headline\":\"Spring Boot: Building a RESTful Web Application\",\"datePublished\":\"2019-09-17T10:00:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/09\\\/spring-boot-building-restful-web-application.html\"},\"wordCount\":292,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/09\\\/spring-boot-building-restful-web-application.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"keywords\":[\"REST\",\"Spring Boot\",\"Web App\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/09\\\/spring-boot-building-restful-web-application.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/09\\\/spring-boot-building-restful-web-application.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/09\\\/spring-boot-building-restful-web-application.html\",\"name\":\"Spring Boot: Building a RESTful Web Application - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/09\\\/spring-boot-building-restful-web-application.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/09\\\/spring-boot-building-restful-web-application.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"datePublished\":\"2019-09-17T10:00:03+00:00\",\"description\":\"Interested to learn about RESTful Web Application? Check our article designing a simple Spring Boot RESTful web application, exposing a few REST endpoints\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/09\\\/spring-boot-building-restful-web-application.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/09\\\/spring-boot-building-restful-web-application.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/09\\\/spring-boot-building-restful-web-application.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"spring-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/09\\\/spring-boot-building-restful-web-application.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Spring Boot: Building a RESTful Web Application\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/b73b076dc62e72de203df7018d398e56\",\"name\":\"Shubhra Srivastava\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9e5d3b016140986463a886392b8400e55ed0aa7742ef29b86a54bd8d5743b68a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9e5d3b016140986463a886392b8400e55ed0aa7742ef29b86a54bd8d5743b68a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9e5d3b016140986463a886392b8400e55ed0aa7742ef29b86a54bd8d5743b68a?s=96&d=mm&r=g\",\"caption\":\"Shubhra Srivastava\"},\"description\":\"Shubhra is a software professional and founder of ProgrammerGirl. She has a great experience with Java\\\/J2EE technologies and frameworks. She loves the amalgam of programming and coffee :)\",\"sameAs\":[\"http:\\\/\\\/www.programmergirl.com\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/shubhra-srivastava224\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/shubhra-srivastava\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring Boot: Building a RESTful Web Application - Java Code Geeks","description":"Interested to learn about RESTful Web Application? Check our article designing a simple Spring Boot RESTful web application, exposing a few REST endpoints","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.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html","og_locale":"en_US","og_type":"article","og_title":"Spring Boot: Building a RESTful Web Application - Java Code Geeks","og_description":"Interested to learn about RESTful Web Application? Check our article designing a simple Spring Boot RESTful web application, exposing a few REST endpoints","og_url":"https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2019-09-17T10:00:03+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","type":"image\/jpeg"}],"author":"Shubhra Srivastava","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Shubhra Srivastava","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html"},"author":{"name":"Shubhra Srivastava","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/b73b076dc62e72de203df7018d398e56"},"headline":"Spring Boot: Building a RESTful Web Application","datePublished":"2019-09-17T10:00:03+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html"},"wordCount":292,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","keywords":["REST","Spring Boot","Web App"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html","url":"https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html","name":"Spring Boot: Building a RESTful Web Application - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","datePublished":"2019-09-17T10:00:03+00:00","description":"Interested to learn about RESTful Web Application? Check our article designing a simple Spring Boot RESTful web application, exposing a few REST endpoints","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","width":150,"height":150,"caption":"spring-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2019\/09\/spring-boot-building-restful-web-application.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Spring Boot: Building a RESTful Web Application"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/b73b076dc62e72de203df7018d398e56","name":"Shubhra Srivastava","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9e5d3b016140986463a886392b8400e55ed0aa7742ef29b86a54bd8d5743b68a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9e5d3b016140986463a886392b8400e55ed0aa7742ef29b86a54bd8d5743b68a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9e5d3b016140986463a886392b8400e55ed0aa7742ef29b86a54bd8d5743b68a?s=96&d=mm&r=g","caption":"Shubhra Srivastava"},"description":"Shubhra is a software professional and founder of ProgrammerGirl. She has a great experience with Java\/J2EE technologies and frameworks. She loves the amalgam of programming and coffee :)","sameAs":["http:\/\/www.programmergirl.com","https:\/\/www.linkedin.com\/in\/shubhra-srivastava224\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/shubhra-srivastava"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/98343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/82253"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=98343"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/98343\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/240"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=98343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=98343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=98343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}