Skip to content

Learning basic SpringBoot JPA using in-memory(database Apache Derby)

Notifications You must be signed in to change notification settings

Kikiodazie/SpringBoot-jpa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpringBoot JPA

A well packaged basic implementation of springboot JPA using spring data and Java Persistence API's.

Original content from JavaTpoint, only change is the package organization.

Getting Started

Clone this repo to your local machine How To Guide

Prerequisites

Installing

Install all project dependencies with:

$ mvn install

How to run

Maven

Open a terminal and run the following commands to ensure that you have valid versions of Java and Maven installed:

$ java -version

$ mvn -v

You should get the versions of Java and Maven.

Using the Maven Plugin

The Spring Boot Maven plugin includes a run goal that can be used to quickly compile and run your application. Applications run in an exploded form, as they do in your IDE. The following example shows a typical Maven command to run a Spring Boot application:

$ mvn spring-boot:run

####Using Executable Jar

To create an executable jar run:

$ mvn clean package

Testing - From JavaTpoint

Step 19: Open the browser and invoke the URL http://localhost:8080/. It returns an empty list because we have not added any user in the List.

To add a user to the database, we will send a POST request by using the Postman.

Step 20: Open the Postman and do the following:

Select the POST

Invoke the URL http://localhost:8080/add-user.

Click on the Body

Select Content-Type as JSON(application/json).

Insert the data which want to insert in the database. We have inserted the following data:

{  
    "id": "001",  
    "name": "john",  
    "email": "john@gmail.com"  
}  

When we click on the Send button, it shows Status:200 OK. It means the request has been successfully executed.

Step 21: Open the browser and invoke the URL http://localhost:8080. It returns the user that we have inserted in the database.

Built With

About

Learning basic SpringBoot JPA using in-memory(database Apache Derby)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages