Giter Club home page Giter Club logo

article-feb20-crud-rest-api-using-spring-boot-spring-data-jpa's Introduction

A Step by Step guide to create CRUD Restful APIs using Spring Boot + Spring Data JPA with H2 in-memory database

Introduction

We will be implementing the below CRUD Restful APIs to manage items for a Catalogue Management System.

HTTP
Method
API Name Path Response
Status Code
POST Create Catalogue Item / 201
(Created)
GET Get Catalogue Items / 200
(Ok)
GET Get Catalogue Item /{sku} 200
(Ok)
PUT Update Catalogue Item /{sku} 200
(Ok)
DELETE Delete Catalogue Item /{sku} 204
(No Content)
POST Upload Catalog Item Picture /{sku}/image 201
(Created)

Technology stack for implementing the Restful APIs...

  • Redhat OpenJDK 8
  • Spring Boot v2.2.4
  • Spring Framework v5.2.3.RELEASE
  • Hibernate v5.4.11.Final
  • JPA v2.0
  • Maven v3.6.3
  • Gradle v6.1.1
  • IntelliJ Idea v2019.3.2

Running the Spring Boot Application

There are couple of ways to run a Spring Boot Application. During development, the ideal one would be to run the main class which is annotated with SpringBootApplication i.e, CrudCatalogueApplication.java in this project. And the other ways are running through maven or gradle.

Run the application using Maven

Use the below command to run the Spring Boot application using Maven

~:\> mvn clean spring-boot:run

Run the application using Gradle

Use the below command to run the Spring Boot application using Gradle

~:\> gradle clean bootRun

Run the application using java -jar command

To run the application using java -jar command, we need to generate the package. Below are the maven and gradle command to generate the jar for the spring boot application.

~:\> mvn clean package

~:\> java -jar target/catalogue-crud-0.0.1-SNAPSHOT.jar 
~:\> gradle clean build

~:\> java -jar build/libs/catalogue-crud-0.0.1-SNAPSHOT.jar 

article-feb20-crud-rest-api-using-spring-boot-spring-data-jpa's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.