{"id":81131,"date":"2018-08-27T16:00:43","date_gmt":"2018-08-27T13:00:43","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=81131"},"modified":"2018-08-27T12:25:58","modified_gmt":"2018-08-27T09:25:58","slug":"restful-api-spring-rest-data-jpa-h2","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2018\/08\/restful-api-spring-rest-data-jpa-h2.html","title":{"rendered":"Restful API using Spring Rest &amp; Spring Data JPA &amp; H2 with Spring Boot Example"},"content":{"rendered":"<p>Hello Friends,<\/p>\n<p>In this tutorial, you will learn the following :<\/p>\n<p><strong>1. Configuring Spring Rest, Spring Data JPA and H2 in Spring Boot<\/strong><br \/>\n<strong>2. Example of Spring Rest, Spring Data JPA, and H2 to create restful services endpoints with Spring Boot<\/strong><br \/>\n<strong>3. Using Swagger to test the Restful endpoints<\/strong><\/p>\n<h2>1. Configuring Spring Rest, Spring Data JPA and H2 in Spring Boot<\/h2>\n<p>Go to <a href=\"https:\/\/start.spring.io\/\" target=\"_blank\" rel=\"noopener\">https:\/\/start.spring.io\/<\/a>\u00a0and create a project with name springRestAndDataJpaWithSpringBoot and with following dependencies :<\/p>\n<p>&#8211; Web<\/p>\n<p>&#8211; JPA<\/p>\n<p>&#8211; H2<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-25-at-6.16.29-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81141\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-25-at-6.16.29-PM.png\" alt=\"Restful API\" width=\"820\" height=\"494\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-25-at-6.16.29-PM.png 1440w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-25-at-6.16.29-PM-300x181.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-25-at-6.16.29-PM-768x463.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-25-at-6.16.29-PM-1024x617.png 1024w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p><b>Note: <\/b>If you are not familiar\u00a0with creating Spring Boot project with Spring Initializer, I would recommend following\u00a0one of my previous posts, <a href=\"https:\/\/www.javacodegeeks.com\/2018\/02\/create-spring-boot-project-spring-initializer.html\" target=\"_blank\" rel=\"noopener\">How to Create Spring Boot Project with Spring Initializer<\/a>\u00a0where I have explained in detail,how we can create a Spring Boot project using Spring Initializer.<\/p>\n<h2>2. Example of Spring Rest, Spring Data JPA, and H2 to create restful services endpoints with Spring Boot<\/h2>\n<p>In this example, We are going to create Rest endpoints to:<\/p>\n<p><strong>&#8211; Create Employee resource<\/strong><\/p>\n<p><strong>&#8211; Retrieve List of Employees<\/strong><\/p>\n<p><strong>&#8211; Retrieve Employee<\/strong><\/p>\n<p><strong>&#8211; Update Employee resource<\/strong><\/p>\n<p><strong>&#8211; Delete Employee resource<\/strong><\/p>\n<p>Following is the <b>FINAL<\/b> directory structure of the project :<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-9.09.56-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81142 size-full\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-9.09.56-PM.png\" alt=\"Restful API\" width=\"524\" height=\"469\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-9.09.56-PM.png 524w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-9.09.56-PM-300x269.png 300w\" sizes=\"(max-width: 524px) 100vw, 524px\" \/><\/a><\/p>\n<p>Let us see the various classes and interfaces that we need to create.<\/p>\n<h3>Step 1<\/h3>\n<p>Export project springRestAndDataJpaWithSpringBoot (that you created via Spring Initializer)from your directory to Eclipse.<\/p>\n<h3>Step 2<\/h3>\n<p>Open Pom.xml.It should have all the dependencies that you added from spring initializer website along with some default dependencies.<\/p>\n<p>Also, I have manually added dependencies to enable Swagger. Swagger is basically used to test rest endpoints.<\/p>\n<pre class=\"brush:xml; wrap-lines:false\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n\r\n&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\nxsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\r\n\r\n&lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n&lt;groupId&gt;nl.blogspot.javasolutionsguide&lt;\/groupId&gt;\r\n&lt;artifactId&gt;springRestAndDataJpaWithSpringBoot&lt;\/artifactId&gt;\r\n&lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\r\n&lt;packaging&gt;jar&lt;\/packaging&gt;\r\n&lt;name&gt;springRestAndDataJpaWithSpringBoot&lt;\/name&gt;\r\n\r\n&lt;description&gt;Demo project for Spring Boot&lt;\/description&gt;\r\n\r\n&lt;parent&gt;\r\n&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n&lt;artifactId&gt;spring-boot-starter-parent&lt;\/artifactId&gt;\r\n&lt;version&gt;2.0.3.RELEASE&lt;\/version&gt;\r\n&lt;relativePath\/&gt; &lt;!-- lookup parent from repository --&gt;\r\n&lt;\/parent&gt;\r\n\r\n&lt;properties&gt;\r\n&lt;project.build.sourceEncoding&gt;UTF-8&lt;\/project.build.sourceEncoding&gt;\r\n&lt;project.reporting.outputEncoding&gt;UTF-8&lt;\/project.reporting.outputEncoding&gt;\r\n&lt;java.version&gt;1.8&lt;\/java.version&gt;\r\n&lt;\/properties&gt;\r\n\r\n&lt;dependencies&gt;\r\n\r\n&lt;dependency&gt;\r\n&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n&lt;artifactId&gt;spring-boot-starter-data-jpa&lt;\/artifactId&gt;\r\n&lt;\/dependency&gt;\r\n\r\n&lt;dependency&gt;\r\n&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n&lt;artifactId&gt;spring-boot-starter-data-rest&lt;\/artifactId&gt;\r\n&lt;\/dependency&gt;\r\n\r\n&lt;dependency&gt;\r\n&lt;groupId&gt;com.h2database&lt;\/groupId&gt;\r\n&lt;artifactId&gt;h2&lt;\/artifactId&gt;\r\n&lt;scope&gt;runtime&lt;\/scope&gt;\r\n&lt;\/dependency&gt;\r\n\r\n&lt;dependency&gt;\r\n&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n&lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;\r\n&lt;scope&gt;test&lt;\/scope&gt;\r\n&lt;\/dependency&gt;\r\n\r\n&lt;dependency&gt;\r\n&lt;groupId&gt;io.springfox&lt;\/groupId&gt;\r\n&lt;artifactId&gt;springfox-swagger2&lt;\/artifactId&gt;\r\n&lt;version&gt;2.7.0&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n\r\n\r\n&lt;dependency&gt;\r\n&lt;groupId&gt;io.springfox&lt;\/groupId&gt;\r\n&lt;artifactId&gt;springfox-swagger-ui&lt;\/artifactId&gt;\r\n&lt;version&gt;2.7.0&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n\r\n&lt;\/dependencies&gt;\r\n\r\n&lt;build&gt;\r\n\r\n&lt;plugins&gt;\r\n &lt;plugin&gt;\r\n  &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n  &lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt;\r\n &lt;\/plugin&gt;\r\n&lt;\/plugins&gt;\r\n\r\n&lt;\/build&gt;\r\n\r\n&lt;\/project&gt;<\/pre>\n<h3>Step 3<\/h3>\n<p>Spring boot has created a java file with name SpringRestAndDataJpaWithSpringBootApplication automatically. This class is used to launch a Spring Boot application. We need to do following in this class :<\/p>\n<h4>&#8211; Enable swagger<\/h4>\n<p>We already added dependencies for Swagger in the Pom.xml.Along with that to enable swagger in Spring boot, we need to put the @EnableSwagger2 annotation on the top of<br \/>\nSpringRestAndDataJpaWithSpringBootApplication class.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>&#8211; Tell Spring Boot which packages to scan to consider beans to be managed by Spring<\/strong><\/p>\n<p>We need to use @ComponentScan(basePackages = &#8220;nl.blogspot.javasolutionsguide.springRestAndDataJpaWithSpringBoot&#8221;)\u00a0on top of\u00a0SpringRestAndDataJpaWithSpringBootApplication class.<\/p>\n<h3>Step 4<\/h3>\n<p>Create Employee entity<\/p>\n<pre class=\"brush:java; wrap-lines:false\">package nl.blogspot.javasolutionsguide.springRestAndDataJpaWithSpringBoot.entity;\r\n\r\nimport javax.persistence.Column;\r\nimport javax.persistence.Entity;\r\nimport javax.persistence.GeneratedValue;\r\nimport javax.persistence.GenerationType;\r\nimport javax.persistence.Id;\r\nimport javax.persistence.Table;\r\n\r\n\/**\r\n\u00a0* @author JavaSolutionsGuide\r\n\u00a0*\r\n\u00a0*\/\r\n@Entity\r\n@Table(name=\"EMPLOYEE\")\r\npublic class Employee {\r\n \r\n @Id\r\n @GeneratedValue(strategy= GenerationType.IDENTITY)\r\n private Long id;\r\n \r\n @Column(name=\"EMPLOYEE_NAME\")\r\n private String name;\r\n \r\n @Column(name=\"EMPLOYEE_SALARY\")\r\n private Integer salary;\r\n \r\n @Column(name=\"DEPARTMENT\")\r\n private String department;\r\n\r\n public Long getId() {\r\n  return id;\r\n }\r\n\r\n public void setId(Long id) {\r\n  this.id = id;\r\n }\r\n\r\n public String getName() {\r\n  return name;\r\n }\r\n\r\n public void setName(String name) {\r\n  this.name = name;\r\n }\r\n\r\n public Integer getSalary() {\r\n  return salary;\r\n }\r\n\r\n public void setSalary(Integer salary) {\r\n  this.salary = salary;\r\n }\r\n\r\n public String getDepartment() {\r\n  return department;\r\n }\r\n\r\n public void setDepartment(String department) {\r\n  this.department = department;\r\n }\r\n}<\/pre>\n<h3>Step 5<\/h3>\n<p>Create Rest Controller with all operations.<\/p>\n<pre class=\"brush:java; wrap-lines:false\">package nl.blogspot.javasolutionsguide.springRestAndDataJpaWithSpringBoot.controller;\r\n\r\nimport java.util.List;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.web.bind.annotation.DeleteMapping;\r\nimport org.springframework.web.bind.annotation.GetMapping;\r\nimport org.springframework.web.bind.annotation.PathVariable;\r\nimport org.springframework.web.bind.annotation.PostMapping;\r\nimport org.springframework.web.bind.annotation.PutMapping;\r\nimport org.springframework.web.bind.annotation.RequestBody;\r\nimport org.springframework.web.bind.annotation.RestController;\r\nimport nl.blogspot.javasolutionsguide.springRestAndDataJpaWithSpringBoot.entity.Employee;\r\nimport nl.blogspot.javasolutionsguide.springRestAndDataJpaWithSpringBoot.service.EmployeeService;\r\n\r\n\/**\r\n\u00a0* @author JavaSolutionsGuide\r\n\u00a0*\r\n\u00a0*\/\r\n@RestController\r\npublic class EmployeeRestController {\r\n \r\n @Autowired\r\n private EmployeeService employeeService;\r\n \r\n public void setEmployeeService(EmployeeService employeeService) {\r\n  this.employeeService = employeeService;\r\n }\r\n\r\n @GetMapping(\"\/api\/employees\")\r\n public List&lt;Employee&gt; getEmployees() {\r\n  List&lt;Employee&gt; employees = employeeService.retrieveEmployees();\r\n  return employees;\r\n }\r\n \r\n @GetMapping(\"\/api\/employees\/{employeeId}\")\r\n public Employee getEmployee(@PathVariable(name=\"employeeId\")Long employeeId) {\r\n  return employeeService.getEmployee(employeeId);\r\n }\r\n \r\n @PostMapping(\"\/api\/employees\")\r\n public void saveEmployee(Employee employee){\r\n  employeeService.saveEmployee(employee);\r\n  System.out.println(\"Employee Saved Successfully\");\r\n }\r\n \r\n @DeleteMapping(\"\/api\/employees\/{employeeId}\")\r\n public void deleteEmployee(@PathVariable(name=\"employeeId\")Long employeeId){\r\n  employeeService.deleteEmployee(employeeId);\r\n  System.out.println(\"Employee Deleted Successfully\");\r\n }\r\n \r\n @PutMapping(\"\/api\/employees\/{employeeId}\")\r\n public void updateEmployee(@RequestBody Employee employee,\r\n   @PathVariable(name=\"employeeId\")Long employeeId){\r\n  Employee emp = employeeService.getEmployee(employeeId);\r\n  if(emp != null){\r\n   employeeService.updateEmployee(employee);\r\n  }\r\n  \r\n }\r\n\r\n}<\/pre>\n<h3>Step 6<\/h3>\n<p>Create Service interface with methods required to retrieve the list of employees, one employee, save employee in the database, delete an employee and update and employee.<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=\"brush:java; wrap-lines:false\">package nl.blogspot.javasolutionsguide.springRestAndDataJpaWithSpringBoot.service;\r\n\r\nimport java.util.List;\r\n\r\nimport nl.blogspot.javasolutionsguide.springRestAndDataJpaWithSpringBoot.entity.Employee;\r\n\r\n\/**\r\n\u00a0* @author JavaSolutionsGuide\r\n\u00a0*\r\n\u00a0*\/\r\npublic interface EmployeeService {\r\n public List&lt;Employee&gt; retrieveEmployees();\r\n \r\n public Employee getEmployee(Long employeeId);\r\n \r\n public void saveEmployee(Employee employee);\r\n \r\n public void deleteEmployee(Long employeeId);\r\n \r\n public void updateEmployee(Employee employee);\r\n}<\/pre>\n<h3>Step 7<\/h3>\n<p>Create Implementation class for the interface created in Step 6<\/p>\n<pre class=\"brush:java; wrap-lines:false\">package nl.blogspot.javasolutionsguide.springRestAndDataJpaWithSpringBoot.service.impl;\r\n\r\nimport java.util.List;\r\nimport java.util.Optional;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.stereotype.Service;\r\nimport nl.blogspot.javasolutionsguide.springRestAndDataJpaWithSpringBoot.entity.Employee;\r\nimport nl.blogspot.javasolutionsguide.springRestAndDataJpaWithSpringBoot.repository.EmployeeRepository;\r\nimport nl.blogspot.javasolutionsguide.springRestAndDataJpaWithSpringBoot.service.EmployeeService;\r\n\r\n\/**\r\n\u00a0* @author JavaSolutionsGuide\r\n\u00a0*\r\n\u00a0*\/\r\n@Service\r\npublic class EmployeeServiceImpl implements EmployeeService{\r\n\r\n @Autowired\r\n private EmployeeRepository employeeRepository;\r\n\r\n public void setEmployeeRepository(EmployeeRepository employeeRepository) {\r\n  this.employeeRepository = employeeRepository;\r\n }\r\n \r\n public List&lt;Employee&gt; retrieveEmployees() {\r\n  List&lt;Employee&gt; employees = employeeRepository.findAll();\r\n  return employees;\r\n }\r\n \r\n public Employee getEmployee(Long employeeId) {\r\n  Optional&lt;Employee&gt; optEmp = employeeRepository.findById(employeeId);\r\n  return optEmp.get();\r\n }\r\n \r\n public void saveEmployee(Employee employee){\r\n  employeeRepository.save(employee);\r\n }\r\n \r\n public void deleteEmployee(Long employeeId){\r\n  employeeRepository.deleteById(employeeId);\r\n }\r\n \r\n public void updateEmployee(Employee employee) {\r\n  employeeRepository.save(employee);\r\n }\r\n}<\/pre>\n<h3>Step 8<\/h3>\n<p>Create a repository class, which will extend Spring data JPA JpaRepository and hence will provide the methods to perform CRUD operations out of the box.<\/p>\n<pre class=\"brush:java; wrap-lines:false\">package nl.blogspot.javasolutionsguide.springRestAndDataJpaWithSpringBoot.repository;\r\n\r\nimport org.springframework.data.jpa.repository.JpaRepository;\r\nimport org.springframework.stereotype.Repository;\r\n\r\nimport nl.blogspot.javasolutionsguide.springRestAndDataJpaWithSpringBoot.entity.Employee;\r\n\r\n@Repository\r\npublic interface EmployeeRepository extends JpaRepository&lt;Employee,Long&gt;{\r\n\r\n}<\/pre>\n<h3>Step 9<\/h3>\n<p>Enable the H2 database web console by adding the following lines in the application.properties file<\/p>\n<pre class=\"brush:bash; wrap-lines:false\">spring.h2.console.enabled=true<\/pre>\n<pre class=\"brush:bash; wrap-lines:false\">spring.h2.console.path=\/h2<\/pre>\n<p>Spring Boot will automatically take care of the creation of the datasource for H2 database,however we can mnaully configure datasource as well in the application.properties file as following :<\/p>\n<pre class=\"brush:bash; wrap-lines:false\">spring.datasource.url=jdbc:h2:file:~\/test<\/pre>\n<pre class=\"brush:bash; wrap-lines:false\">spring.datasource.username=sa<\/pre>\n<pre class=\"brush:bash; wrap-lines:false\">spring.datasource.password=spring.datasource.driver-class-name=org.h2.Driver<\/pre>\n<h3>Step 10<\/h3>\n<p>With this you are done with creation of your restful API using Spring Rest,spring data JPA with h2 database.<\/p>\n<p>Now you just need to run your\u00a0SpringRestAndDataJpaWithSpringBootApplication.java class and it will make sure that it will build your code, package your code in the jar and deploy it onto the embedded tomcat server.<\/p>\n<h3>Step 11<\/h3>\n<p>Open H2 database console by hitting following URL<\/p>\n<pre class=\"brush:bash; wrap-lines:false\">http:\/\/localhost:8080\/h2\/<\/pre>\n<p>It will show you the following screen :<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.28.57-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81144 size-full\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.28.57-PM.png\" alt=\"Restful API\" width=\"702\" height=\"468\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.28.57-PM.png 702w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.28.57-PM-300x200.png 300w\" sizes=\"(max-width: 702px) 100vw, 702px\" \/><\/a><\/p>\n<p>Click on the Connect button and it will connect you to the H2 database. and you can see that the EMPLOYEE table has been created, but there is no data in this table, which is as we expected.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-25-at-7.33.20-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81145\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-25-at-7.33.20-PM.png\" alt=\"Restful API\" width=\"820\" height=\"223\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-25-at-7.33.20-PM.png 1440w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-25-at-7.33.20-PM-300x81.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-25-at-7.33.20-PM-768x209.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-25-at-7.33.20-PM-1024x278.png 1024w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<h2>3. Using Swagger to test the Restful endpoints<\/h2>\n<p>To test your rest endpoints, hit the Swagger URL follows :<\/p>\n<pre class=\"brush:bash; wrap-lines:false\">http:\/\/localhost:8080\/swagger-ui.html<\/pre>\n<p>It will open the following page<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.20.40-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81146\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.20.40-PM.png\" alt=\"Restful API\" width=\"820\" height=\"471\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.20.40-PM.png 1431w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.20.40-PM-300x172.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.20.40-PM-768x441.png 768w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.20.40-PM-1024x588.png 1024w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>Click on the employee-rest-controller link. It will show you the supported operations by this controller as follows:<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.19.33-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81147\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.19.33-PM.png\" alt=\"Restful API\" width=\"820\" height=\"198\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.19.33-PM.png 964w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.19.33-PM-300x73.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.19.33-PM-768x186.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>Now we can see five endpoints in the above screenshot. We will test them one by one.<\/p>\n<h3>Save Employee &#8211; \/api\/employees<\/h3>\n<p>The first thing we need to do is to create a resource in the database.for that we will use POST operation and use \/api\/employees endpoint.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.42.10-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81148\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.42.10-PM.png\" alt=\"Restful API\" width=\"820\" height=\"25\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.42.10-PM.png 965w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.42.10-PM-300x9.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.42.10-PM-768x24.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>Click on the saveEmployee and fill all the required data that we need to create a resource and then click on &#8220;try it out&#8221;\u00a0button.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.48.27-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81149\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.48.27-PM.png\" alt=\"Restful API\" width=\"820\" height=\"400\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.48.27-PM.png 959w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.48.27-PM-300x146.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.48.27-PM-768x375.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>This is how your request and response will look like<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.26.43-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81150\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.26.43-PM.png\" alt=\"Restful API\" width=\"820\" height=\"411\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.26.43-PM.png 959w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.26.43-PM-300x150.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.26.43-PM-768x385.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>As you can see that the response code is 200, which means SUCCESS and hence our record should have been created in the H2 database.<\/p>\n<p>Let us check that.<\/p>\n<p>Open H2 web console and query the EMPLOYEE table and you can see the record that we pushed from Swagger UI.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.33.20-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81151 size-full\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.33.20-PM.png\" alt=\"Restful API\" width=\"792\" height=\"381\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.33.20-PM.png 792w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.33.20-PM-300x144.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-21-at-10.33.20-PM-768x369.png 768w\" sizes=\"(max-width: 792px) 100vw, 792px\" \/><\/a><\/p>\n<p>Similarly, Insert one more employee from Swagger UI with the following data :<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.50.53-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81152\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.50.53-PM.png\" alt=\"Restful API\" width=\"820\" height=\"403\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.50.53-PM.png 959w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.50.53-PM-300x147.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.50.53-PM-768x377.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>Query database again and you will see two records in the database as follows :<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.52.19-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81153\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.52.19-PM.png\" alt=\"Restful API\" width=\"820\" height=\"413\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.52.19-PM.png 864w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.52.19-PM-300x151.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.52.19-PM-768x387.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<h3>Get Employees -\/api\/employees<\/h3>\n<p>Now as we have already inserted two records\u00a0 in the database, we will try to retrieve these records with the help of GET operation and using \/api\/employees endpoint as follows :<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.53.21-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81154\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.53.21-PM.png\" alt=\"Restful API\" width=\"820\" height=\"30\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.53.21-PM.png 964w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.53.21-PM-300x11.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.53.21-PM-768x28.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>Click on the getEmployees and then as we want to retrieve the list of all employees, we need not pass any parameter.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.55.52-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81155\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.55.52-PM.png\" alt=\"Restful API\" width=\"820\" height=\"486\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.55.52-PM.png 961w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.55.52-PM-300x178.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.55.52-PM-768x455.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>Hence Just click on &#8220;try it out&#8221; button and you will get a list of employees in the response.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.59.00-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81157\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.59.00-PM.png\" alt=\"Restful API\" width=\"820\" height=\"527\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.59.00-PM.png 961w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.59.00-PM-300x193.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-12.59.00-PM-768x494.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<h3>Get Employee\u00a0<b>&#8211; <\/b>\/api\/employees\/{employeeId}<\/h3>\n<p>Next, we will retrieve only one employee on the basis of input employeeId using GET operation. We will pass employeeId to the rest endpoint \/api\/employees\/{employeeId}.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.01.13-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81158\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.01.13-PM.png\" alt=\"Restful API\" width=\"961\" height=\"33\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.01.13-PM.png 961w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.01.13-PM-300x10.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.01.13-PM-768x26.png 768w\" sizes=\"(max-width: 961px) 100vw, 961px\" \/><\/a><\/p>\n<p>Click on the getEmployee and fill employeeId as 1, which means that we want to retrieve employee with employeeId 1.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.05.01-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81159\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.05.01-PM.png\" alt=\"Restful API\" width=\"820\" height=\"569\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.05.01-PM.png 962w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.05.01-PM-300x208.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.05.01-PM-768x532.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>Click on try it out button and you will see data of employee with employeeId 1 in the response as follows :<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.07.17-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81160\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.07.17-PM.png\" alt=\"Restful API\" width=\"820\" height=\"403\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.07.17-PM.png 961w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.07.17-PM-300x147.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.07.17-PM-768x377.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<h3>Update Employee &#8211;\u00a0\/api\/employees\/{employeeId}<\/h3>\n<p>Next, we will test the update employee rest endpoint using PUT operation and by using \/api\/employees\/{employeeId} endpoint.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.21.08-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81161\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.21.08-PM.png\" alt=\"Restful API\" width=\"820\" height=\"27\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.21.08-PM.png 964w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.21.08-PM-300x10.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.21.08-PM-768x25.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>Click on the updateEmployee link. Paste one of the employee json\u00a0and put corresponding employeeId as follows :<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.24.40-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81163\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.24.40-PM.png\" alt=\"Restful API\" width=\"820\" height=\"551\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.24.40-PM.png 962w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.24.40-PM-300x201.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.24.40-PM-768x516.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>Click on &#8220;Try it out&#8221; button and you will see following response with response code 200(SUCCESS).<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.25.55-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81164\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.25.55-PM.png\" alt=\"Restful API\" width=\"820\" height=\"309\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.25.55-PM.png 962w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.25.55-PM-300x113.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.25.55-PM-768x290.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>Verify updated record with updated salary to 3000 from 1000 in the EMPLOYEE table in H2 database for employee with employeeId 1.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.27.33-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81165\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.27.33-PM.png\" alt=\"Restful API\" width=\"820\" height=\"407\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.27.33-PM.png 878w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.27.33-PM-300x149.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-2.27.33-PM-768x381.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<h3>Delete Employee &#8211;\u00a0<b>&#8211; <\/b>\/api\/employees\/{employeeId}<\/h3>\n<p>Next, we will test the delete Employee rest endpoint using DELETE operation and be using \/api\/employees\/{employeeId} endpoint.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.13.45-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81166\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.13.45-PM.png\" alt=\"Restful API\" width=\"820\" height=\"29\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.13.45-PM.png 961w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.13.45-PM-300x11.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.13.45-PM-768x27.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>Click on deteleEmployee link and fill employeeId 1, which means that we want to delete employee with employeeId 1.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.15.06-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81167\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.15.06-PM.png\" alt=\"Restful API\" width=\"820\" height=\"301\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.15.06-PM.png 961w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.15.06-PM-300x110.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.15.06-PM-768x282.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>Click on &#8220;try it out&#8221; button and you will get response code 200, which means the request is successfully processed.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.16.50-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81168\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.16.50-PM.png\" alt=\"Restful API\" width=\"820\" height=\"314\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.16.50-PM.png 962w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.16.50-PM-300x115.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.16.50-PM-768x294.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>Let us verify if an employee with employeeId 1 has been successfully deleted from the database by opening H2 console and querying database.<\/p>\n<p><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.18.27-PM.png\"><img decoding=\"async\" class=\"aligncenter wp-image-81169\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.18.27-PM.png\" alt=\"Restful API\" width=\"820\" height=\"413\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.18.27-PM.png 836w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.18.27-PM-300x151.png 300w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2018\/08\/Screen-Shot-2018-08-26-at-1.18.27-PM-768x387.png 768w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><\/a><\/p>\n<p>As we can see above that we have the only employee with employeeId 2 in the EMPLOYEE table, hence employee with employeeId 1 has been successfully deleted.<\/p>\n<h2>Summary<\/h2>\n<p>So in the above post, we saw how we can create restful API using Spring rest, Spring Data JPA and H2 database with Spring Boot.<\/p>\n<p><strong>We need to:<\/strong><\/p>\n<p>&#8211; Create Spring Boot project from spring Initializer with required dependencies.<\/p>\n<p>&#8211; Enable swagger support by adding additional dependencies in POM.xml and adding annotation in the spring boot application class.<\/p>\n<p>&#8211; Enable the H2 database by adding necessary properties in the application.properties.<\/p>\n<p>&#8211; Write Rest Controller, Service, repository\u00a0and entity to work upon.<\/p>\n<p>&#8211; Start Spring boot application, which will be automatically deployed to an embedded server.<\/p>\n<p>&#8211; Test the rest endpoints using Swagger UI and verify data in the H2 database using the H2 console.<\/p>\n<p>Thanks for reading. Share it with someone you think it might be helpful.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Java Code Geeks with permission by Gaurav Bhardwaj, partner at our <a href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener\">JCG program<\/a>. See the original article here: <a href=\"http:\/\/javasolutionsguide.blogspot.com\/2018\/08\/restful-api-using-spring-rest-spring.html\" target=\"_blank\" rel=\"noopener\">Restful API using Spring Rest + Spring Data JPA + H2 with Spring Boot Example<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello Friends, In this tutorial, you will learn the following : 1. Configuring Spring Rest, Spring Data JPA and H2 in Spring Boot 2. Example of Spring Rest, Spring Data JPA, and H2 to create restful services endpoints with Spring Boot 3. Using Swagger to test the Restful endpoints 1. Configuring Spring Rest, Spring Data &hellip;<\/p>\n","protected":false},"author":955,"featured_media":240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[33,815,30,854,321],"class_list":["post-81131","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-jpa","tag-rest","tag-spring","tag-spring-boot","tag-spring-data"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Restful API using Spring Rest &amp; Spring Data JPA &amp; H2 with Spring Boot Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn more about Restful API? Check out our Spring Boot Example where we use Spring Rest + Spring Data JPA + H2 on a Restful API!\" \/>\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\/2018\/08\/restful-api-spring-rest-data-jpa-h2.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Restful API using Spring Rest &amp; Spring Data JPA &amp; H2 with Spring Boot Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn more about Restful API? Check out our Spring Boot Example where we use Spring Rest + Spring Data JPA + H2 on a Restful API!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2018\/08\/restful-api-spring-rest-data-jpa-h2.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=\"2018-08-27T13:00:43+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=\"Gaurav Bhardwaj\" \/>\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=\"Gaurav Bhardwaj\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/08\\\/restful-api-spring-rest-data-jpa-h2.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/08\\\/restful-api-spring-rest-data-jpa-h2.html\"},\"author\":{\"name\":\"Gaurav Bhardwaj\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/58bd3e1f6edc1bed6a6374fe9a34ca37\"},\"headline\":\"Restful API using Spring Rest &amp; Spring Data JPA &amp; H2 with Spring Boot Example\",\"datePublished\":\"2018-08-27T13:00:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/08\\\/restful-api-spring-rest-data-jpa-h2.html\"},\"wordCount\":1301,\"commentCount\":13,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/08\\\/restful-api-spring-rest-data-jpa-h2.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"keywords\":[\"JPA\",\"REST\",\"Spring\",\"Spring Boot\",\"Spring Data\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/08\\\/restful-api-spring-rest-data-jpa-h2.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/08\\\/restful-api-spring-rest-data-jpa-h2.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/08\\\/restful-api-spring-rest-data-jpa-h2.html\",\"name\":\"Restful API using Spring Rest &amp; Spring Data JPA &amp; H2 with Spring Boot Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/08\\\/restful-api-spring-rest-data-jpa-h2.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/08\\\/restful-api-spring-rest-data-jpa-h2.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/spring-logo.jpg\",\"datePublished\":\"2018-08-27T13:00:43+00:00\",\"description\":\"Interested to learn more about Restful API? Check out our Spring Boot Example where we use Spring Rest + Spring Data JPA + H2 on a Restful API!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/08\\\/restful-api-spring-rest-data-jpa-h2.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/08\\\/restful-api-spring-rest-data-jpa-h2.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2018\\\/08\\\/restful-api-spring-rest-data-jpa-h2.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\\\/2018\\\/08\\\/restful-api-spring-rest-data-jpa-h2.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\":\"Restful API using Spring Rest &amp; Spring Data JPA &amp; H2 with Spring Boot Example\"}]},{\"@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\\\/58bd3e1f6edc1bed6a6374fe9a34ca37\",\"name\":\"Gaurav Bhardwaj\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g\",\"caption\":\"Gaurav Bhardwaj\"},\"description\":\"Gaurav has done Masters in Computer Applications(MCA) and is working in Software development field for more than 10 years in Java\\\/J2EE technologies. He is currently working with one of top MNC. He has worked on various frameworks like Struts, Spring, Spring Boot, Angular JS, JSF, Velocity, iBatis, MyBatis, Hibernate, JUnit, Mockito, Dozzer. He likes to explore new technologies and share his thoughts by writing a technical blog. He is the founder of JavaSolutionsGuide.blogspot.com.\",\"sameAs\":[\"http:\\\/\\\/www.javasolutionsguide.blogspot.nl\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/gaurav-bhardwaj\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Restful API using Spring Rest &amp; Spring Data JPA &amp; H2 with Spring Boot Example - Java Code Geeks","description":"Interested to learn more about Restful API? Check out our Spring Boot Example where we use Spring Rest + Spring Data JPA + H2 on a Restful API!","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\/2018\/08\/restful-api-spring-rest-data-jpa-h2.html","og_locale":"en_US","og_type":"article","og_title":"Restful API using Spring Rest &amp; Spring Data JPA &amp; H2 with Spring Boot Example - Java Code Geeks","og_description":"Interested to learn more about Restful API? Check out our Spring Boot Example where we use Spring Rest + Spring Data JPA + H2 on a Restful API!","og_url":"https:\/\/www.javacodegeeks.com\/2018\/08\/restful-api-spring-rest-data-jpa-h2.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2018-08-27T13:00:43+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":"Gaurav Bhardwaj","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Gaurav Bhardwaj","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2018\/08\/restful-api-spring-rest-data-jpa-h2.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/08\/restful-api-spring-rest-data-jpa-h2.html"},"author":{"name":"Gaurav Bhardwaj","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/58bd3e1f6edc1bed6a6374fe9a34ca37"},"headline":"Restful API using Spring Rest &amp; Spring Data JPA &amp; H2 with Spring Boot Example","datePublished":"2018-08-27T13:00:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/08\/restful-api-spring-rest-data-jpa-h2.html"},"wordCount":1301,"commentCount":13,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/08\/restful-api-spring-rest-data-jpa-h2.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","keywords":["JPA","REST","Spring","Spring Boot","Spring Data"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2018\/08\/restful-api-spring-rest-data-jpa-h2.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2018\/08\/restful-api-spring-rest-data-jpa-h2.html","url":"https:\/\/www.javacodegeeks.com\/2018\/08\/restful-api-spring-rest-data-jpa-h2.html","name":"Restful API using Spring Rest &amp; Spring Data JPA &amp; H2 with Spring Boot Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/08\/restful-api-spring-rest-data-jpa-h2.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/08\/restful-api-spring-rest-data-jpa-h2.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/spring-logo.jpg","datePublished":"2018-08-27T13:00:43+00:00","description":"Interested to learn more about Restful API? Check out our Spring Boot Example where we use Spring Rest + Spring Data JPA + H2 on a Restful API!","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2018\/08\/restful-api-spring-rest-data-jpa-h2.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2018\/08\/restful-api-spring-rest-data-jpa-h2.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2018\/08\/restful-api-spring-rest-data-jpa-h2.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\/2018\/08\/restful-api-spring-rest-data-jpa-h2.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":"Restful API using Spring Rest &amp; Spring Data JPA &amp; H2 with Spring Boot Example"}]},{"@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\/58bd3e1f6edc1bed6a6374fe9a34ca37","name":"Gaurav Bhardwaj","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/657921afcac1f1ddf98dfb349121a07b4dcc1d42d5bd277150cf3ed8156de723?s=96&d=mm&r=g","caption":"Gaurav Bhardwaj"},"description":"Gaurav has done Masters in Computer Applications(MCA) and is working in Software development field for more than 10 years in Java\/J2EE technologies. He is currently working with one of top MNC. He has worked on various frameworks like Struts, Spring, Spring Boot, Angular JS, JSF, Velocity, iBatis, MyBatis, Hibernate, JUnit, Mockito, Dozzer. He likes to explore new technologies and share his thoughts by writing a technical blog. He is the founder of JavaSolutionsGuide.blogspot.com.","sameAs":["http:\/\/www.javasolutionsguide.blogspot.nl\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/gaurav-bhardwaj"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/81131","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\/955"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=81131"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/81131\/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=81131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=81131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=81131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}